comparison src/http/ngx_http_parse.c @ 342:4276c2f1f434 NGINX_0_6_15

nginx 0.6.15 *) Feature: cygwin compatibility. Thanks to Vladimir Kutakov. *) Feature: the "merge_slashes" directive. *) Feature: the "gzip_vary" directive. *) Feature: the "server_tokens" directive. *) Bugfix: nginx did not unescape URI in the "include" SSI command. *) Bugfix: the segmentation fault was occurred on start or while reconfiguration if variable was used in the "charset" or "source_charset" directives. *) Bugfix: nginx returned the 400 response on requests like "GET http://www.domain.com HTTP/1.0". Thanks to James Oakley. *) Bugfix: if request with request body was redirected using the "error_page" directive, then nginx tried to read the request body again; bug appeared in 0.6.7. *) Bugfix: a segmentation fault occurred in worker process if no server_name was explicitly defined for server processing request; bug appeared in 0.6.7.
author Igor Sysoev <http://sysoev.ru>
date Mon, 22 Oct 2007 00:00:00 +0400
parents cba14c1e2a4b
children eae74a780a84
comparison
equal deleted inserted replaced
341:183b4761fe5b 342:4276c2f1f434
333 333
334 if ((ch >= '0' && ch <= '9') || ch == '.' || ch == '-') { 334 if ((ch >= '0' && ch <= '9') || ch == '.' || ch == '-') {
335 break; 335 break;
336 } 336 }
337 337
338 r->host_end = p;
339
338 switch (ch) { 340 switch (ch) {
339 case ':': 341 case ':':
340 r->host_end = p;
341 state = sw_port; 342 state = sw_port;
342 break; 343 break;
343 case '/': 344 case '/':
344 r->host_end = p;
345 r->uri_start = p; 345 r->uri_start = p;
346 state = sw_after_slash_in_uri; 346 state = sw_after_slash_in_uri;
347 break; 347 break;
348 default: 348 case ' ':
349 r->host_end = p; 349 /*
350 * use single "/" from request line to preserve pointers,
351 * if request line will be copied to large client buffer
352 */
353 r->uri_start = r->schema_end + 1;
354 r->uri_end = r->schema_end + 2;
355 state = sw_http_09;
356 break;
357 default:
350 return NGX_HTTP_PARSE_INVALID_REQUEST; 358 return NGX_HTTP_PARSE_INVALID_REQUEST;
351 } 359 }
352 break; 360 break;
353 361
354 case sw_port: 362 case sw_port:
359 switch (ch) { 367 switch (ch) {
360 case '/': 368 case '/':
361 r->port_end = p; 369 r->port_end = p;
362 r->uri_start = p; 370 r->uri_start = p;
363 state = sw_after_slash_in_uri; 371 state = sw_after_slash_in_uri;
372 break;
373 case ' ':
374 r->port_end = p;
375 /*
376 * use single "/" from request line to preserve pointers,
377 * if request line will be copied to large client buffer
378 */
379 r->uri_start = r->schema_end + 1;
380 r->uri_end = r->schema_end + 2;
381 state = sw_http_09;
364 break; 382 break;
365 default: 383 default:
366 return NGX_HTTP_PARSE_INVALID_REQUEST; 384 return NGX_HTTP_PARSE_INVALID_REQUEST;
367 } 385 }
368 break; 386 break;
888 return NGX_HTTP_PARSE_HEADER_DONE; 906 return NGX_HTTP_PARSE_HEADER_DONE;
889 } 907 }
890 908
891 909
892 ngx_int_t 910 ngx_int_t
893 ngx_http_parse_complex_uri(ngx_http_request_t *r) 911 ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
894 { 912 {
895 u_char c, ch, decoded, *p, *u; 913 u_char c, ch, decoded, *p, *u;
896 enum { 914 enum {
897 sw_usual = 0, 915 sw_usual = 0,
898 sw_slash, 916 sw_slash,
996 } 1014 }
997 1015
998 switch(ch) { 1016 switch(ch) {
999 #if (NGX_WIN32) 1017 #if (NGX_WIN32)
1000 case '\\': 1018 case '\\':
1019 break;
1001 #endif 1020 #endif
1002 case '/': 1021 case '/':
1022 if (merge_slashes) {
1023 *u++ = ch;
1024 }
1003 break; 1025 break;
1004 case '.': 1026 case '.':
1005 state = sw_dot; 1027 state = sw_dot;
1006 *u++ = ch; 1028 *u++ = ch;
1007 break; 1029 break;