Mercurial > hg > nginx
diff 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 |
line wrap: on
line diff
--- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -277,6 +277,7 @@ static void ngx_http_init_request(ngx_ev static void ngx_http_process_request_line(ngx_event_t *rev) { + char *p; ssize_t n; ngx_int_t rc, offset; ngx_connection_t *c; @@ -307,11 +308,13 @@ static void ngx_http_process_request_lin /* the request line has been parsed successfully */ - /* TODO: we need to handle such URIs */ + /* TODO: we need to handle proxy URIs */ if (r->unusual_uri) { r->request_line.len = r->request_end - r->request_start; r->request_line.data = r->request_start; +#if 0 r->request_line.data[r->request_line.len] = '\0'; +#endif ngx_http_client_error(r, NGX_HTTP_PARSE_INVALID_REQUEST, NGX_HTTP_BAD_REQUEST); @@ -372,7 +375,6 @@ static void ngx_http_process_request_lin if (rc != NGX_OK) { r->request_line.len = r->request_end - r->request_start; r->request_line.data = r->request_start; - r->request_line.data[r->request_line.len] = '\0'; ngx_http_client_error(r, rc, NGX_HTTP_BAD_REQUEST); return; @@ -482,6 +484,15 @@ static void ngx_http_process_request_lin /* there was error while a request line parsing */ + for (p = r->request_start; p < r->header_in->last; p++) { + if (*p == CR || *p == LF) { + break; + } + } + + r->request_line.len = p - r->request_start; + r->request_line.data = r->request_start; + ngx_http_client_error(r, rc, NGX_HTTP_BAD_REQUEST); return; @@ -1564,6 +1575,11 @@ static void ngx_http_client_error(ngx_ht ctx->client, ctx->url); } else { + if (error == NGX_HTTP_REQUEST_URI_TOO_LARGE) { + r->request_line.len = r->header_in->end - r->request_start; + r->request_line.data = r->request_start; + } + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, client_header_errors[client_error - NGX_HTTP_CLIENT_ERROR], ctx->client);