comparison src/http/ngx_http_request.c @ 336:1c519aff5c0c NGINX_0_6_12

nginx 0.6.12 *) Change: mail proxy was split on three modules: pop3, imap and smtp. *) Feature: the --without-mail_pop3_module, --without-mail_imap_module, and --without-mail_smtp_module configuration parameters. *) Feature: the "smtp_greeting_delay" and "smtp_client_buffer" directives of the ngx_mail_smtp_module. *) Bugfix: the trailing wildcards did not work; bug appeared in 0.6.9. *) Bugfix: nginx could not start on Solaris if the shared PCRE library located in non-standard place was used. *) Bugfix: the "proxy_hide_header" and "fastcgi_hide_header" directives did not hide response header lines whose name was longer than 32 characters. Thanks to Manlio Perillo.
author Igor Sysoev <http://sysoev.ru>
date Fri, 21 Sep 2007 00:00:00 +0400
parents 3a91bfeffaba
children 10cc350ed8a1
comparison
equal deleted inserted replaced
335:9a32ae248b7a 336:1c519aff5c0c
18 ngx_uint_t request_line); 18 ngx_uint_t request_line);
19 19
20 static ngx_int_t ngx_http_process_header_line(ngx_http_request_t *r, 20 static ngx_int_t ngx_http_process_header_line(ngx_http_request_t *r,
21 ngx_table_elt_t *h, ngx_uint_t offset); 21 ngx_table_elt_t *h, ngx_uint_t offset);
22 static ngx_int_t ngx_http_process_unique_header_line(ngx_http_request_t *r, 22 static ngx_int_t ngx_http_process_unique_header_line(ngx_http_request_t *r,
23 ngx_table_elt_t *h, ngx_uint_t offset);
24 static ngx_int_t ngx_http_process_connection(ngx_http_request_t *r,
23 ngx_table_elt_t *h, ngx_uint_t offset); 25 ngx_table_elt_t *h, ngx_uint_t offset);
24 static ngx_int_t ngx_http_process_cookie(ngx_http_request_t *r, 26 static ngx_int_t ngx_http_process_cookie(ngx_http_request_t *r,
25 ngx_table_elt_t *h, ngx_uint_t offset); 27 ngx_table_elt_t *h, ngx_uint_t offset);
26 28
27 static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r); 29 static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r);
69 ngx_http_header_t ngx_http_headers_in[] = { 71 ngx_http_header_t ngx_http_headers_in[] = {
70 { ngx_string("Host"), offsetof(ngx_http_headers_in_t, host), 72 { ngx_string("Host"), offsetof(ngx_http_headers_in_t, host),
71 ngx_http_process_unique_header_line }, 73 ngx_http_process_unique_header_line },
72 74
73 { ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection), 75 { ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection),
74 ngx_http_process_unique_header_line }, 76 ngx_http_process_connection },
75 77
76 { ngx_string("If-Modified-Since"), 78 { ngx_string("If-Modified-Since"),
77 offsetof(ngx_http_headers_in_t, if_modified_since), 79 offsetof(ngx_http_headers_in_t, if_modified_since),
78 ngx_http_process_unique_header_line }, 80 ngx_http_process_unique_header_line },
79 81
1197 return NGX_ERROR; 1199 return NGX_ERROR;
1198 } 1200 }
1199 1201
1200 1202
1201 static ngx_int_t 1203 static ngx_int_t
1204 ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h,
1205 ngx_uint_t offset)
1206 {
1207 if (ngx_strstr(h->value.data, "close")) {
1208 r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE;
1209
1210 } else if (ngx_strstr(h->value.data, "keep-alive")) {
1211 r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE;
1212 }
1213
1214 return NGX_OK;
1215 }
1216
1217
1218 static ngx_int_t
1202 ngx_http_process_cookie(ngx_http_request_t *r, ngx_table_elt_t *h, 1219 ngx_http_process_cookie(ngx_http_request_t *r, ngx_table_elt_t *h,
1203 ngx_uint_t offset) 1220 ngx_uint_t offset)
1204 { 1221 {
1205 ngx_table_elt_t **cookie; 1222 ngx_table_elt_t **cookie;
1206 1223
1292 "client sent POST method without \"Content-Length\" header"); 1309 "client sent POST method without \"Content-Length\" header");
1293 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED); 1310 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
1294 return NGX_ERROR; 1311 return NGX_ERROR;
1295 } 1312 }
1296 1313
1297 if (r->method & (NGX_HTTP_TRACE)) { 1314 if (r->method & NGX_HTTP_TRACE) {
1298 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, 1315 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1299 "client sent TRACE method"); 1316 "client sent TRACE method");
1300 ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED); 1317 ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED);
1301 return NGX_ERROR; 1318 return NGX_ERROR;
1302 } 1319 }
1315 "client sent plain HTTP request to HTTPS port"); 1332 "client sent plain HTTP request to HTTPS port");
1316 ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS); 1333 ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS);
1317 return NGX_ERROR; 1334 return NGX_ERROR;
1318 } 1335 }
1319 1336
1320 if (r->headers_in.connection) { 1337 if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) {
1321 if (r->headers_in.connection->value.len == 5 1338 if (r->headers_in.keep_alive) {
1322 && ngx_strcasecmp(r->headers_in.connection->value.data, 1339 r->headers_in.keep_alive_n =
1323 (u_char *) "close") 1340 ngx_atotm(r->headers_in.keep_alive->value.data,
1324 == 0) 1341 r->headers_in.keep_alive->value.len);
1325 {
1326 r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE;
1327
1328 } else if (r->headers_in.connection->value.len == 10
1329 && ngx_strcasecmp(r->headers_in.connection->value.data,
1330 (u_char *) "keep-alive")
1331 == 0)
1332 {
1333 r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE;
1334
1335 if (r->headers_in.keep_alive) {
1336 r->headers_in.keep_alive_n =
1337 ngx_atotm(r->headers_in.keep_alive->value.data,
1338 r->headers_in.keep_alive->value.len);
1339 }
1340 } 1342 }
1341 } 1343 }
1342 1344
1343 if (r->headers_in.user_agent) { 1345 if (r->headers_in.user_agent) {
1344 1346