comparison src/http/ngx_http_special_response.c @ 2787:3daf68f2efe3

ngx_http_filter_finalize_request() and ngx_http_clean_header()
author Igor Sysoev <igor@sysoev.ru>
date Fri, 01 May 2009 18:41:07 +0000
parents ae4744c28620
children 43fe53832da7
comparison
equal deleted inserted replaced
2786:4e002555652d 2787:3daf68f2efe3
443 443
444 return ngx_http_send_special_response(r, clcf, err); 444 return ngx_http_send_special_response(r, clcf, err);
445 } 445 }
446 446
447 447
448 ngx_int_t
449 ngx_http_filter_finalize_request(ngx_http_request_t *r, ngx_int_t error)
450 {
451 ngx_int_t rc;
452
453 ngx_http_clean_header(r);
454
455 /* clear the modules contexts */
456 ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
457
458 rc = ngx_http_special_response_handler(r, error);
459
460 /* NGX_ERROR resets any pending data */
461
462 return (rc == NGX_OK) ? NGX_ERROR : rc;
463 }
464
465
466 void
467 ngx_http_clean_header(ngx_http_request_t *r)
468 {
469 ngx_memzero(&r->headers_out.status,
470 sizeof(ngx_http_headers_out_t)
471 - offsetof(ngx_http_headers_out_t, status));
472
473 r->headers_out.headers.part.nelts = 0;
474 r->headers_out.headers.part.next = NULL;
475 r->headers_out.headers.last = &r->headers_out.headers.part;
476
477 r->headers_out.content_length_n = -1;
478 r->headers_out.last_modified_time = -1;
479 }
480
481
448 static ngx_int_t 482 static ngx_int_t
449 ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page) 483 ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page)
450 { 484 {
451 ngx_int_t overwrite; 485 ngx_int_t overwrite;
452 ngx_str_t uri, args; 486 ngx_str_t uri, args;