Klaus Demo nginx / 8fd830a
set "Content-Length: 0" for errors handled by "return 204" Igor Sysoev 15 years ago
3 changed file(s) with 26 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
429429 unsigned plain_http:1;
430430 unsigned chunked:1;
431431 unsigned header_only:1;
432 unsigned zero_body:1;
432433 unsigned keepalive:1;
433434 unsigned lingering_close:1;
434435 unsigned discard_body:1;
840840
841841 if (code->status == NGX_HTTP_NO_CONTENT) {
842842 e->request->header_only = 1;
843 e->request->zero_body = 1;
843844 }
844845
845846 e->ip += sizeof(ngx_http_script_return_code_t) - sizeof(uintptr_t);
454454
455455 msie_padding = 0;
456456
457 if (error_pages[err].len) {
458 r->headers_out.content_length_n = error_pages[err].len
459 + sizeof(error_tail) - 1;
460
461 if (clcf->msie_padding
462 && r->headers_in.msie
463 && r->http_version >= NGX_HTTP_VERSION_10
464 && error >= NGX_HTTP_BAD_REQUEST
465 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE)
466 {
467 r->headers_out.content_length_n += sizeof(ngx_http_msie_stub) - 1;
468 msie_padding = 1;
469 }
470
471 r->headers_out.content_type.len = sizeof("text/html") - 1;
472 r->headers_out.content_type.data = (u_char *) "text/html";
457 if (!r->zero_body) {
458 if (error_pages[err].len) {
459 r->headers_out.content_length_n = error_pages[err].len
460 + sizeof(error_tail) - 1;
461
462 if (clcf->msie_padding
463 && r->headers_in.msie
464 && r->http_version >= NGX_HTTP_VERSION_10
465 && error >= NGX_HTTP_BAD_REQUEST
466 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE)
467 {
468 r->headers_out.content_length_n +=
469 sizeof(ngx_http_msie_stub) - 1;
470 msie_padding = 1;
471 }
472
473 r->headers_out.content_type.len = sizeof("text/html") - 1;
474 r->headers_out.content_type.data = (u_char *) "text/html";
475
476 } else {
477 r->headers_out.content_length_n = -1;
478 }
473479
474480 } else {
475 r->headers_out.content_length_n = -1;
481 r->headers_out.content_length_n = 0;
482 err = 0;
476483 }
477484
478485 if (r->headers_out.content_length) {