comparison src/http/modules/ngx_http_chunked_filter_module.c @ 3578:28ee756697b1 stable-0.7

merge r3412, r3485: *) allow a chunked body for 201 responses *) chunked_transfer_encoding
author Igor Sysoev <igor@sysoev.ru>
date Mon, 07 Jun 2010 09:19:10 +0000
parents e274c8e5d49c
children
comparison
equal deleted inserted replaced
3577:376a648e4541 3578:28ee756697b1
48 48
49 49
50 static ngx_int_t 50 static ngx_int_t
51 ngx_http_chunked_header_filter(ngx_http_request_t *r) 51 ngx_http_chunked_header_filter(ngx_http_request_t *r)
52 { 52 {
53 ngx_http_core_loc_conf_t *clcf;
54
53 if (r->headers_out.status == NGX_HTTP_NOT_MODIFIED 55 if (r->headers_out.status == NGX_HTTP_NOT_MODIFIED
54 || r->headers_out.status == NGX_HTTP_NO_CONTENT 56 || r->headers_out.status == NGX_HTTP_NO_CONTENT
55 || r->headers_out.status == NGX_HTTP_CREATED
56 || r != r->main 57 || r != r->main
57 || (r->method & NGX_HTTP_HEAD)) 58 || (r->method & NGX_HTTP_HEAD))
58 { 59 {
59 return ngx_http_next_header_filter(r); 60 return ngx_http_next_header_filter(r);
60 } 61 }
62 if (r->headers_out.content_length_n == -1) { 63 if (r->headers_out.content_length_n == -1) {
63 if (r->http_version < NGX_HTTP_VERSION_11) { 64 if (r->http_version < NGX_HTTP_VERSION_11) {
64 r->keepalive = 0; 65 r->keepalive = 0;
65 66
66 } else { 67 } else {
67 r->chunked = 1; 68 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
69
70 if (clcf->chunked_transfer_encoding) {
71 r->chunked = 1;
72
73 } else {
74 r->keepalive = 0;
75 }
68 } 76 }
69 } 77 }
70 78
71 return ngx_http_next_header_filter(r); 79 return ngx_http_next_header_filter(r);
72 } 80 }