comparison src/http/ngx_http_parse.c @ 1584:25427a0e9559

allow full URL without URI part: "GET http://host HTTP/1.0"
author Igor Sysoev <igor@sysoev.ru>
date Thu, 18 Oct 2007 11:33:31 +0000
parents 67077918b965
children 4435ca2e467d
comparison
equal deleted inserted replaced
1583:45cbc1aa8652 1584:25427a0e9559
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;