Mercurial > hg > nginx-vendor-1-0
comparison src/http/ngx_http_request.c @ 230:38e7b94d63ac NGINX_0_4_0
nginx 0.4.0
*) Change in internal API: the HTTP modules initialization was moved
from the init module phase to the HTTP postconfiguration phase.
*) Change: now the request body is not read beforehand for the
ngx_http_perl_module: it's required to start the reading using the
$r->has_request_body method.
*) Feature: the ngx_http_perl_module supports the DECLINED return code.
*) Feature: the ngx_http_dav_module supports the incoming "Date" header
line for the PUT method.
*) Feature: the "ssi" directive is available inside the "if" block.
*) Bugfix: a segmentation fault occurred if there was an "index"
directive with variables and the first index name was without
variables; bug appeared in 0.1.29.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 30 Aug 2006 00:00:00 +0400 |
parents | 21f2ace7c936 |
children | c982febb7588 |
comparison
equal
deleted
inserted
replaced
229:1965c8e23be7 | 230:38e7b94d63ac |
---|---|
137 #if (NGX_HTTP_DAV) | 137 #if (NGX_HTTP_DAV) |
138 { ngx_string("Depth"), offsetof(ngx_http_headers_in_t, depth), | 138 { ngx_string("Depth"), offsetof(ngx_http_headers_in_t, depth), |
139 ngx_http_process_header_line }, | 139 ngx_http_process_header_line }, |
140 | 140 |
141 { ngx_string("Destination"), offsetof(ngx_http_headers_in_t, destination), | 141 { ngx_string("Destination"), offsetof(ngx_http_headers_in_t, destination), |
142 ngx_http_process_header_line }, | |
143 | |
144 { ngx_string("Date"), offsetof(ngx_http_headers_in_t, date), | |
142 ngx_http_process_header_line }, | 145 ngx_http_process_header_line }, |
143 #endif | 146 #endif |
144 | 147 |
145 { ngx_string("Cookie"), 0, ngx_http_process_cookie }, | 148 { ngx_string("Cookie"), 0, ngx_http_process_cookie }, |
146 | 149 |
931 static ssize_t | 934 static ssize_t |
932 ngx_http_read_request_header(ngx_http_request_t *r) | 935 ngx_http_read_request_header(ngx_http_request_t *r) |
933 { | 936 { |
934 ssize_t n; | 937 ssize_t n; |
935 ngx_event_t *rev; | 938 ngx_event_t *rev; |
939 ngx_connection_t *c; | |
936 ngx_http_core_srv_conf_t *cscf; | 940 ngx_http_core_srv_conf_t *cscf; |
937 | 941 |
938 rev = r->connection->read; | 942 c = r->connection; |
943 rev = c->read; | |
939 | 944 |
940 n = r->header_in->last - r->header_in->pos; | 945 n = r->header_in->last - r->header_in->pos; |
941 | 946 |
942 if (n > 0) { | 947 if (n > 0) { |
943 return n; | 948 return n; |
944 } | 949 } |
945 | 950 |
946 if (rev->ready) { | 951 if (rev->ready) { |
947 n = r->connection->recv(r->connection, r->header_in->last, | 952 n = c->recv(c, r->header_in->last, |
948 r->header_in->end - r->header_in->last); | 953 r->header_in->end - r->header_in->last); |
949 } else { | 954 } else { |
950 n = NGX_AGAIN; | 955 n = NGX_AGAIN; |
951 } | 956 } |
952 | 957 |
953 if (n == NGX_AGAIN) { | 958 if (n == NGX_AGAIN) { |
964 | 969 |
965 return NGX_AGAIN; | 970 return NGX_AGAIN; |
966 } | 971 } |
967 | 972 |
968 if (n == 0) { | 973 if (n == 0) { |
969 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | 974 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
970 "client closed prematurely connection"); | 975 "client closed prematurely connection"); |
971 } | 976 } |
972 | 977 |
973 if (n == 0 || n == NGX_ERROR) { | 978 if (n == 0 || n == NGX_ERROR) { |
979 c->error = rev->error; | |
980 c->log->action = "sending response to client"; | |
981 | |
974 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); | 982 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
975 return NGX_ERROR; | 983 return NGX_ERROR; |
976 } | 984 } |
977 | 985 |
978 r->header_in->last += n; | 986 r->header_in->last += n; |
1153 *ph = h; | 1161 *ph = h; |
1154 return NGX_OK; | 1162 return NGX_OK; |
1155 } | 1163 } |
1156 | 1164 |
1157 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | 1165 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
1158 "client sent duplicate header line: \"%V: %V\"", | 1166 "client sent duplicate header line: \"%V: %V\", " |
1159 &h->key, &h->value); | 1167 "previous value: \"%V: %V\"", |
1168 &h->key, &h->value, &(*ph)->key, &(*ph)->value); | |
1160 | 1169 |
1161 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); | 1170 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); |
1162 | 1171 |
1163 return NGX_ERROR; | 1172 return NGX_ERROR; |
1164 } | 1173 } |
1457 } | 1466 } |
1458 | 1467 |
1459 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 1468 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1460 "http finalize request: %d, \"%V?%V\"", | 1469 "http finalize request: %d, \"%V?%V\"", |
1461 rc, &r->uri, &r->args); | 1470 rc, &r->uri, &r->args); |
1471 | |
1472 if (rc == NGX_DECLINED) { | |
1473 r->content_handler = NULL; | |
1474 r->write_event_handler = ngx_http_core_run_phases; | |
1475 ngx_http_core_run_phases(r); | |
1476 return; | |
1477 } | |
1462 | 1478 |
1463 if (r != r->main | 1479 if (r != r->main |
1464 && rc != NGX_ERROR | 1480 && rc != NGX_ERROR |
1465 && !r->connection->error | 1481 && !r->connection->error |
1466 && !r->request_output | 1482 && !r->request_output |