mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 06:03:31 -06:00
nginx-0.0.1-2003-03-12-20:32:22 import
This commit is contained in:
parent
b738757f35
commit
90ace68b69
@ -166,7 +166,7 @@ static int ngx_http_init_request(ngx_event_t *ev)
|
||||
r->header_in = c->buffer;
|
||||
|
||||
ngx_test_null(r->pool, ngx_create_pool(ngx_http_request_pool_size, ev->log),
|
||||
ngx_http_close_request(r));
|
||||
NGX_ERROR);
|
||||
|
||||
ngx_test_null(r->ctx,
|
||||
ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module),
|
||||
@ -935,8 +935,9 @@ static int ngx_http_keepalive_handler(ngx_event_t *ev)
|
||||
|
||||
ngx_log_debug(ev->log, "http keepalive handler");
|
||||
|
||||
if (ev->timedout)
|
||||
if (ev->timedout) {
|
||||
return NGX_DONE;
|
||||
}
|
||||
|
||||
/* MSIE closes keepalive connection with RST flag
|
||||
so we ignore ECONNRESET here */
|
||||
@ -946,8 +947,9 @@ static int ngx_http_keepalive_handler(ngx_event_t *ev)
|
||||
n = ngx_event_recv(c, c->buffer->last, c->buffer->end - c->buffer->last);
|
||||
ev->ignore_econnreset = 0;
|
||||
|
||||
if (n == NGX_AGAIN || n == NGX_ERROR)
|
||||
if (n == NGX_AGAIN || n == NGX_ERROR) {
|
||||
return n;
|
||||
}
|
||||
|
||||
ctx = (ngx_http_log_ctx_t *) ev->log->data;
|
||||
ev->log->handler = NULL;
|
||||
|
@ -76,6 +76,8 @@ static ngx_str_t error_pages[] = {
|
||||
{ 0, NULL}, /* 412 */
|
||||
{ 0, NULL}, /* 413 */
|
||||
{ sizeof(error_414_page) - 1, error_414_page },
|
||||
{ 0, NULL}, /* 415 */
|
||||
{ 0, NULL}, /* 416 */
|
||||
|
||||
{ sizeof(error_500_page) - 1, error_500_page }
|
||||
};
|
||||
@ -90,20 +92,31 @@ int ngx_http_special_response(ngx_http_request_t *r, int error)
|
||||
|
||||
r->headers_out.status = error;
|
||||
|
||||
if (error < NGX_HTTP_BAD_REQUEST)
|
||||
if (error < NGX_HTTP_BAD_REQUEST) {
|
||||
err = error - NGX_HTTP_MOVED_PERMANENTLY;
|
||||
|
||||
else if (error < NGX_HTTP_INTERNAL_SERVER_ERROR)
|
||||
} else if (error < NGX_HTTP_INTERNAL_SERVER_ERROR) {
|
||||
err = error - NGX_HTTP_BAD_REQUEST + 4;
|
||||
|
||||
else
|
||||
err = error - NGX_HTTP_INTERNAL_SERVER_ERROR + 4 + 15;
|
||||
} else {
|
||||
err = error - NGX_HTTP_INTERNAL_SERVER_ERROR + 4 + 17;
|
||||
}
|
||||
|
||||
if (error_pages[err].len == 0)
|
||||
if (r->keepalive != 0) {
|
||||
switch (error) {
|
||||
case NGX_HTTP_BAD_REQUEST:
|
||||
case NGX_HTTP_REQUEST_URI_TOO_LARGE:
|
||||
case NGX_HTTP_INTERNAL_SERVER_ERROR:
|
||||
r->keepalive = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (error_pages[err].len == 0) {
|
||||
r->headers_out.content_length = -1;
|
||||
else
|
||||
} else {
|
||||
r->headers_out.content_length = error_pages[err].len
|
||||
+ len + sizeof(error_tail);
|
||||
}
|
||||
|
||||
if (ngx_http_send_header(r) == NGX_ERROR) {
|
||||
return NGX_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user