Mercurial > hg > nginx-ranges
comparison src/http/ngx_http_request.c @ 308:94e16de3c33f NGINX_0_5_24
nginx 0.5.24
*) Security: the "ssl_verify_client" directive did not work if request
was made using HTTP/0.9.
*) Bugfix: a part of response body might be passed uncompressed if gzip
was used; bug appeared in 0.5.23.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 06 Jun 2007 00:00:00 +0400 |
parents | 55328d69b335 |
children | 429900ca25ee |
comparison
equal
deleted
inserted
replaced
307:0bcb7f864b94 | 308:94e16de3c33f |
---|---|
23 ngx_table_elt_t *h, ngx_uint_t offset); | 23 ngx_table_elt_t *h, ngx_uint_t offset); |
24 static ngx_int_t ngx_http_process_cookie(ngx_http_request_t *r, | 24 static ngx_int_t ngx_http_process_cookie(ngx_http_request_t *r, |
25 ngx_table_elt_t *h, ngx_uint_t offset); | 25 ngx_table_elt_t *h, ngx_uint_t offset); |
26 | 26 |
27 static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r); | 27 static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r); |
28 static void ngx_http_process_request(ngx_http_request_t *r); | |
28 static void ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, | 29 static void ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, |
29 size_t len, ngx_uint_t hash); | 30 size_t len, ngx_uint_t hash); |
30 | 31 |
31 static void ngx_http_request_handler(ngx_event_t *ev); | 32 static void ngx_http_request_handler(ngx_event_t *ev); |
32 static ngx_int_t ngx_http_set_write_handler(ngx_http_request_t *r); | 33 static ngx_int_t ngx_http_set_write_handler(ngx_http_request_t *r); |
709 | 710 |
710 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 711 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
711 "http exten: \"%V\"", &r->exten); | 712 "http exten: \"%V\"", &r->exten); |
712 | 713 |
713 if (r->http_version < NGX_HTTP_VERSION_10) { | 714 if (r->http_version < NGX_HTTP_VERSION_10) { |
714 | 715 ngx_http_process_request(r); |
715 if (rev->timer_set) { | |
716 ngx_del_timer(rev); | |
717 } | |
718 | |
719 #if (NGX_STAT_STUB) | |
720 ngx_atomic_fetch_add(ngx_stat_reading, -1); | |
721 r->stat_reading = 0; | |
722 ngx_atomic_fetch_add(ngx_stat_writing, 1); | |
723 r->stat_writing = 1; | |
724 #endif | |
725 | |
726 rev->handler = ngx_http_request_handler; | |
727 c->write->handler = ngx_http_request_handler; | |
728 r->read_event_handler = ngx_http_block_read; | |
729 | |
730 ngx_http_handler(r); | |
731 | |
732 return; | 716 return; |
733 } | 717 } |
734 | 718 |
735 | 719 |
736 if (ngx_list_init(&r->headers_in.headers, r->pool, 20, | 720 if (ngx_list_init(&r->headers_in.headers, r->pool, 20, |
943 | 927 |
944 if (rc != NGX_OK) { | 928 if (rc != NGX_OK) { |
945 return; | 929 return; |
946 } | 930 } |
947 | 931 |
948 if (rev->timer_set) { | 932 ngx_http_process_request(r); |
949 ngx_del_timer(rev); | |
950 } | |
951 | |
952 #if (NGX_STAT_STUB) | |
953 ngx_atomic_fetch_add(ngx_stat_reading, -1); | |
954 r->stat_reading = 0; | |
955 ngx_atomic_fetch_add(ngx_stat_writing, 1); | |
956 r->stat_writing = 1; | |
957 #endif | |
958 | |
959 rev->handler = ngx_http_request_handler; | |
960 c->write->handler = ngx_http_request_handler; | |
961 r->read_event_handler = ngx_http_block_read; | |
962 | |
963 ngx_http_handler(r); | |
964 | 933 |
965 return; | 934 return; |
966 } | 935 } |
967 | 936 |
968 if (rc == NGX_AGAIN) { | 937 if (rc == NGX_AGAIN) { |
1248 | 1217 |
1249 | 1218 |
1250 static ngx_int_t | 1219 static ngx_int_t |
1251 ngx_http_process_request_header(ngx_http_request_t *r) | 1220 ngx_http_process_request_header(ngx_http_request_t *r) |
1252 { | 1221 { |
1253 size_t len; | 1222 size_t len; |
1254 u_char *host, *ua, *user_agent, ch; | 1223 u_char *host, *ua, *user_agent, ch; |
1255 ngx_uint_t hash; | 1224 ngx_uint_t hash; |
1256 #if (NGX_HTTP_SSL) | |
1257 long rc; | |
1258 ngx_http_ssl_srv_conf_t *sscf; | |
1259 #endif | |
1260 | 1225 |
1261 if (r->headers_in.host) { | 1226 if (r->headers_in.host) { |
1262 | 1227 |
1263 hash = 0; | 1228 hash = 0; |
1264 | 1229 |
1417 r->headers_in.konqueror = 1; | 1382 r->headers_in.konqueror = 1; |
1418 } | 1383 } |
1419 } | 1384 } |
1420 } | 1385 } |
1421 | 1386 |
1387 return NGX_OK; | |
1388 } | |
1389 | |
1390 | |
1391 static void | |
1392 ngx_http_process_request(ngx_http_request_t *r) | |
1393 { | |
1394 ngx_connection_t *c; | |
1422 #if (NGX_HTTP_SSL) | 1395 #if (NGX_HTTP_SSL) |
1423 | 1396 long rc; |
1424 if (r->connection->ssl) { | 1397 ngx_http_ssl_srv_conf_t *sscf; |
1398 #endif | |
1399 | |
1400 c = r->connection; | |
1401 | |
1402 #if (NGX_HTTP_SSL) | |
1403 | |
1404 if (c->ssl) { | |
1425 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module); | 1405 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module); |
1426 | 1406 |
1427 if (sscf->verify) { | 1407 if (sscf->verify) { |
1428 rc = SSL_get_verify_result(r->connection->ssl->connection); | 1408 rc = SSL_get_verify_result(c->ssl->connection); |
1429 | 1409 |
1430 if (rc != X509_V_OK) { | 1410 if (rc != X509_V_OK) { |
1431 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | 1411 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1432 "client SSL certificate verify error: (%l:%s)", | 1412 "client SSL certificate verify error: (%l:%s)", |
1433 rc, X509_verify_cert_error_string(rc)); | 1413 rc, X509_verify_cert_error_string(rc)); |
1434 ngx_http_finalize_request(r, NGX_HTTPS_CERT_ERROR); | 1414 ngx_http_finalize_request(r, NGX_HTTPS_CERT_ERROR); |
1435 return NGX_ERROR; | 1415 return; |
1436 } | 1416 } |
1437 | 1417 |
1438 if (SSL_get_peer_certificate(r->connection->ssl->connection) | 1418 if (SSL_get_peer_certificate(c->ssl->connection) |
1439 == NULL) | 1419 == NULL) |
1440 { | 1420 { |
1441 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | 1421 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
1442 "client sent no required SSL certificate"); | 1422 "client sent no required SSL certificate"); |
1443 ngx_http_finalize_request(r, NGX_HTTPS_NO_CERT); | 1423 ngx_http_finalize_request(r, NGX_HTTPS_NO_CERT); |
1444 return NGX_ERROR; | 1424 return; |
1445 } | 1425 } |
1446 } | 1426 } |
1447 } | 1427 } |
1448 | 1428 |
1449 #endif | 1429 #endif |
1450 | 1430 |
1451 return NGX_OK; | 1431 if (c->read->timer_set) { |
1432 ngx_del_timer(c->read); | |
1433 } | |
1434 | |
1435 #if (NGX_STAT_STUB) | |
1436 ngx_atomic_fetch_add(ngx_stat_reading, -1); | |
1437 r->stat_reading = 0; | |
1438 ngx_atomic_fetch_add(ngx_stat_writing, 1); | |
1439 r->stat_writing = 1; | |
1440 #endif | |
1441 | |
1442 c->read->handler = ngx_http_request_handler; | |
1443 c->write->handler = ngx_http_request_handler; | |
1444 r->read_event_handler = ngx_http_block_read; | |
1445 | |
1446 ngx_http_handler(r); | |
1447 | |
1448 return; | |
1452 } | 1449 } |
1453 | 1450 |
1454 | 1451 |
1455 static void | 1452 static void |
1456 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len, | 1453 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len, |