Mercurial > hg > nginx
comparison src/http/ngx_http_request.c @ 220:4f81b931e9ff
nginx-0.0.1-2004-01-08-11:47:17 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 08 Jan 2004 08:47:17 +0000 |
parents | 05592fd7a436 |
children | 1119faf4635a |
comparison
equal
deleted
inserted
replaced
219:f57597ec5249 | 220:4f81b931e9ff |
---|---|
275 } | 275 } |
276 | 276 |
277 | 277 |
278 static void ngx_http_process_request_line(ngx_event_t *rev) | 278 static void ngx_http_process_request_line(ngx_event_t *rev) |
279 { | 279 { |
280 char *p; | |
280 ssize_t n; | 281 ssize_t n; |
281 ngx_int_t rc, offset; | 282 ngx_int_t rc, offset; |
282 ngx_connection_t *c; | 283 ngx_connection_t *c; |
283 ngx_http_request_t *r; | 284 ngx_http_request_t *r; |
284 ngx_http_log_ctx_t *ctx; | 285 ngx_http_log_ctx_t *ctx; |
305 | 306 |
306 if (rc == NGX_OK) { | 307 if (rc == NGX_OK) { |
307 | 308 |
308 /* the request line has been parsed successfully */ | 309 /* the request line has been parsed successfully */ |
309 | 310 |
310 /* TODO: we need to handle such URIs */ | 311 /* TODO: we need to handle proxy URIs */ |
311 if (r->unusual_uri) { | 312 if (r->unusual_uri) { |
312 r->request_line.len = r->request_end - r->request_start; | 313 r->request_line.len = r->request_end - r->request_start; |
313 r->request_line.data = r->request_start; | 314 r->request_line.data = r->request_start; |
315 #if 0 | |
314 r->request_line.data[r->request_line.len] = '\0'; | 316 r->request_line.data[r->request_line.len] = '\0'; |
317 #endif | |
315 | 318 |
316 ngx_http_client_error(r, NGX_HTTP_PARSE_INVALID_REQUEST, | 319 ngx_http_client_error(r, NGX_HTTP_PARSE_INVALID_REQUEST, |
317 NGX_HTTP_BAD_REQUEST); | 320 NGX_HTTP_BAD_REQUEST); |
318 return; | 321 return; |
319 } | 322 } |
370 } | 373 } |
371 | 374 |
372 if (rc != NGX_OK) { | 375 if (rc != NGX_OK) { |
373 r->request_line.len = r->request_end - r->request_start; | 376 r->request_line.len = r->request_end - r->request_start; |
374 r->request_line.data = r->request_start; | 377 r->request_line.data = r->request_start; |
375 r->request_line.data[r->request_line.len] = '\0'; | |
376 | 378 |
377 ngx_http_client_error(r, rc, NGX_HTTP_BAD_REQUEST); | 379 ngx_http_client_error(r, rc, NGX_HTTP_BAD_REQUEST); |
378 return; | 380 return; |
379 } | 381 } |
380 | 382 |
479 return; | 481 return; |
480 | 482 |
481 } else if (rc != NGX_AGAIN) { | 483 } else if (rc != NGX_AGAIN) { |
482 | 484 |
483 /* there was error while a request line parsing */ | 485 /* there was error while a request line parsing */ |
486 | |
487 for (p = r->request_start; p < r->header_in->last; p++) { | |
488 if (*p == CR || *p == LF) { | |
489 break; | |
490 } | |
491 } | |
492 | |
493 r->request_line.len = p - r->request_start; | |
494 r->request_line.data = r->request_start; | |
484 | 495 |
485 ngx_http_client_error(r, rc, NGX_HTTP_BAD_REQUEST); | 496 ngx_http_client_error(r, rc, NGX_HTTP_BAD_REQUEST); |
486 | 497 |
487 return; | 498 return; |
488 } | 499 } |
1562 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 1573 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1563 client_header_errors[client_error - NGX_HTTP_CLIENT_ERROR], | 1574 client_header_errors[client_error - NGX_HTTP_CLIENT_ERROR], |
1564 ctx->client, ctx->url); | 1575 ctx->client, ctx->url); |
1565 | 1576 |
1566 } else { | 1577 } else { |
1578 if (error == NGX_HTTP_REQUEST_URI_TOO_LARGE) { | |
1579 r->request_line.len = r->header_in->end - r->request_start; | |
1580 r->request_line.data = r->request_start; | |
1581 } | |
1582 | |
1567 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 1583 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
1568 client_header_errors[client_error - NGX_HTTP_CLIENT_ERROR], | 1584 client_header_errors[client_error - NGX_HTTP_CLIENT_ERROR], |
1569 ctx->client); | 1585 ctx->client); |
1570 } | 1586 } |
1571 | 1587 |