comparison src/http/ngx_http_request.c @ 293:ec3c049681fd

nginx-0.0.3-2004-03-19-08:25:53 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 19 Mar 2004 05:25:53 +0000
parents 117ccc7c4055
children 5cfd65b8b0a7
comparison
equal deleted inserted replaced
292:a472bfb778b3 293:ec3c049681fd
36 "client %s sent invalid method in HTTP/0.9 request", 36 "client %s sent invalid method in HTTP/0.9 request",
37 37
38 "client %s sent invalid header, URL: %s", 38 "client %s sent invalid header, URL: %s",
39 "client %s sent too long header line, URL: %s", 39 "client %s sent too long header line, URL: %s",
40 "client %s sent HTTP/1.1 request without \"Host\" header, URL: %s", 40 "client %s sent HTTP/1.1 request without \"Host\" header, URL: %s",
41 "client %s sent invalid \"Content-Length\" header, URL: %s" 41 "client %s sent invalid \"Content-Length\" header, URL: %s",
42 "client %s wanted to send too large body: " SIZE_T_FMT " bytes, URL: %s"
42 }; 43 };
43 44
44 45
45 #if 0 46 #if 0
46 static void ngx_http_dummy(ngx_event_t *wev) 47 static void ngx_http_dummy(ngx_event_t *wev)
845 r->headers_in.content_length->value.len); 846 r->headers_in.content_length->value.len);
846 847
847 if (r->headers_in.content_length_n == NGX_ERROR) { 848 if (r->headers_in.content_length_n == NGX_ERROR) {
848 return NGX_HTTP_PARSE_INVALID_CL_HEADER; 849 return NGX_HTTP_PARSE_INVALID_CL_HEADER;
849 } 850 }
851
852 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
853
854 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
855 "http cl: " SIZE_T_FMT " max: " SIZE_T_FMT,
856 r->headers_in.content_length_n,
857 clcf->client_max_body_size);
858
859 if (clcf->client_max_body_size
860 && clcf->client_max_body_size
861 < (size_t) r->headers_in.content_length_n)
862 {
863 return NGX_HTTP_PARSE_ENTITY_TOO_LARGE;
864 }
865
850 } 866 }
851 867
852 if (r->headers_in.connection) { 868 if (r->headers_in.connection) {
853 if (r->headers_in.connection->value.len == 5 869 if (r->headers_in.connection->value.len == 5
854 && ngx_strcasecmp(r->headers_in.connection->value.data, "close") 870 && ngx_strcasecmp(r->headers_in.connection->value.data, "close")
882 898
883 if (rc == NGX_DONE || r->main) { 899 if (rc == NGX_DONE || r->main) {
884 return; 900 return;
885 } 901 }
886 902
887 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 903 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
888 "http finalize request"); 904 "http finalize request: %d", rc);
889 905
890 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { 906 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
891 907
892 if (r->connection->read->timer_set) { 908 if (r->connection->read->timer_set) {
893 ngx_del_timer(r->connection->read); 909 ngx_del_timer(r->connection->read);
1588 } 1604 }
1589 1605
1590 r->connection->log->handler = NULL; 1606 r->connection->log->handler = NULL;
1591 1607
1592 if (ctx->url) { 1608 if (ctx->url) {
1593 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 1609 if (client_error == NGX_HTTP_PARSE_ENTITY_TOO_LARGE) {
1610 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
1611 client_header_errors[client_error - NGX_HTTP_CLIENT_ERROR],
1612 ctx->client, r->headers_in.content_length_n, ctx->url);
1613
1614 error = NGX_HTTP_REQUEST_ENTITY_TOO_LARGE;
1615 r->lingering_close = 1;
1616
1617 } else {
1618 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
1594 client_header_errors[client_error - NGX_HTTP_CLIENT_ERROR], 1619 client_header_errors[client_error - NGX_HTTP_CLIENT_ERROR],
1595 ctx->client, ctx->url); 1620 ctx->client, ctx->url);
1621 }
1596 1622
1597 } else { 1623 } else {
1598 if (error == NGX_HTTP_REQUEST_URI_TOO_LARGE) { 1624 if (error == NGX_HTTP_REQUEST_URI_TOO_LARGE) {
1599 r->request_line.len = r->header_in->end - r->request_start; 1625 r->request_line.len = r->header_in->end - r->request_start;
1600 r->request_line.data = r->request_start; 1626 r->request_line.data = r->request_start;