comparison src/http/ngx_http_header_filter_module.c @ 654:753f505670e0 NGINX_1_1_11

nginx 1.1.11 *) Feature: the "so_keepalive" parameter of the "listen" directive. Thanks to Vsevolod Stakhov. *) Feature: the "if_not_empty" parameter of the "fastcgi/scgi/uwsgi_param" directives. *) Feature: the $https variable. *) Feature: the "proxy_redirect" directive supports variables in the first parameter. *) Feature: the "proxy_redirect" directive supports regular expressions. *) Bugfix: the $sent_http_cache_control variable might contain a wrong value if the "expires" directive was used. Thanks to Yichun Zhang. *) Bugfix: the "read_ahead" directive might not work combined with "try_files" and "open_file_cache". *) Bugfix: a segmentation fault might occur in a worker process if small time was used in the "inactive" parameter of the "proxy_cache_path" directive. *) Bugfix: responses from cache might hang.
author Igor Sysoev <http://sysoev.ru>
date Mon, 12 Dec 2011 00:00:00 +0400
parents c456a023113c
children d0f7a625f27c
comparison
equal deleted inserted replaced
653:8c96af2112c1 654:753f505670e0
59 ngx_null_string, /* "205 Reset Content" */ 59 ngx_null_string, /* "205 Reset Content" */
60 ngx_string("206 Partial Content"), 60 ngx_string("206 Partial Content"),
61 61
62 /* ngx_null_string, */ /* "207 Multi-Status" */ 62 /* ngx_null_string, */ /* "207 Multi-Status" */
63 63
64 #define NGX_HTTP_LAST_LEVEL_200 207 64 #define NGX_HTTP_LAST_2XX 207
65 #define NGX_HTTP_LEVEL_200 (NGX_HTTP_LAST_LEVEL_200 - 200) 65 #define NGX_HTTP_OFF_3XX (NGX_HTTP_LAST_2XX - 200)
66 66
67 /* ngx_null_string, */ /* "300 Multiple Choices" */ 67 /* ngx_null_string, */ /* "300 Multiple Choices" */
68 68
69 ngx_string("301 Moved Permanently"), 69 ngx_string("301 Moved Permanently"),
70 ngx_string("302 Moved Temporarily"), 70 ngx_string("302 Moved Temporarily"),
73 73
74 /* ngx_null_string, */ /* "305 Use Proxy" */ 74 /* ngx_null_string, */ /* "305 Use Proxy" */
75 /* ngx_null_string, */ /* "306 unused" */ 75 /* ngx_null_string, */ /* "306 unused" */
76 /* ngx_null_string, */ /* "307 Temporary Redirect" */ 76 /* ngx_null_string, */ /* "307 Temporary Redirect" */
77 77
78 #define NGX_HTTP_LAST_LEVEL_300 305 78 #define NGX_HTTP_LAST_3XX 305
79 #define NGX_HTTP_LEVEL_300 (NGX_HTTP_LAST_LEVEL_300 - 301) 79 #define NGX_HTTP_OFF_4XX (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
80 80
81 ngx_string("400 Bad Request"), 81 ngx_string("400 Bad Request"),
82 ngx_string("401 Unauthorized"), 82 ngx_string("401 Unauthorized"),
83 ngx_string("402 Payment Required"), 83 ngx_string("402 Payment Required"),
84 ngx_string("403 Forbidden"), 84 ngx_string("403 Forbidden"),
106 /* ngx_null_string, */ /* "421 unused" */ 106 /* ngx_null_string, */ /* "421 unused" */
107 /* ngx_null_string, */ /* "422 Unprocessable Entity" */ 107 /* ngx_null_string, */ /* "422 Unprocessable Entity" */
108 /* ngx_null_string, */ /* "423 Locked" */ 108 /* ngx_null_string, */ /* "423 Locked" */
109 /* ngx_null_string, */ /* "424 Failed Dependency" */ 109 /* ngx_null_string, */ /* "424 Failed Dependency" */
110 110
111 #define NGX_HTTP_LAST_LEVEL_400 417 111 #define NGX_HTTP_LAST_4XX 417
112 #define NGX_HTTP_LEVEL_400 (NGX_HTTP_LAST_LEVEL_400 - 400) 112 #define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)
113 113
114 ngx_string("500 Internal Server Error"), 114 ngx_string("500 Internal Server Error"),
115 ngx_string("501 Method Not Implemented"), 115 ngx_string("501 Method Not Implemented"),
116 ngx_string("502 Bad Gateway"), 116 ngx_string("502 Bad Gateway"),
117 ngx_string("503 Service Temporarily Unavailable"), 117 ngx_string("503 Service Temporarily Unavailable"),
122 ngx_string("507 Insufficient Storage"), 122 ngx_string("507 Insufficient Storage"),
123 /* ngx_null_string, */ /* "508 unused" */ 123 /* ngx_null_string, */ /* "508 unused" */
124 /* ngx_null_string, */ /* "509 unused" */ 124 /* ngx_null_string, */ /* "509 unused" */
125 /* ngx_null_string, */ /* "510 Not Extended" */ 125 /* ngx_null_string, */ /* "510 Not Extended" */
126 126
127 #define NGX_HTTP_LAST_LEVEL_500 508 127 #define NGX_HTTP_LAST_5XX 508
128 128
129 }; 129 };
130 130
131 131
132 ngx_http_header_out_t ngx_http_headers_out[] = { 132 ngx_http_header_out_t ngx_http_headers_out[] = {
214 } else { 214 } else {
215 215
216 status = r->headers_out.status; 216 status = r->headers_out.status;
217 217
218 if (status >= NGX_HTTP_OK 218 if (status >= NGX_HTTP_OK
219 && status < NGX_HTTP_LAST_LEVEL_200) 219 && status < NGX_HTTP_LAST_2XX)
220 { 220 {
221 /* 2XX */ 221 /* 2XX */
222 222
223 if (status == NGX_HTTP_NO_CONTENT) { 223 if (status == NGX_HTTP_NO_CONTENT) {
224 r->header_only = 1; 224 r->header_only = 1;
232 status -= NGX_HTTP_OK; 232 status -= NGX_HTTP_OK;
233 status_line = &ngx_http_status_lines[status]; 233 status_line = &ngx_http_status_lines[status];
234 len += ngx_http_status_lines[status].len; 234 len += ngx_http_status_lines[status].len;
235 235
236 } else if (status >= NGX_HTTP_MOVED_PERMANENTLY 236 } else if (status >= NGX_HTTP_MOVED_PERMANENTLY
237 && status < NGX_HTTP_LAST_LEVEL_300) 237 && status < NGX_HTTP_LAST_3XX)
238 { 238 {
239 /* 3XX */ 239 /* 3XX */
240 240
241 if (status == NGX_HTTP_NOT_MODIFIED) { 241 if (status == NGX_HTTP_NOT_MODIFIED) {
242 r->header_only = 1; 242 r->header_only = 1;
243 } 243 }
244 244
245 status = status - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_LEVEL_200; 245 status = status - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_OFF_3XX;
246 status_line = &ngx_http_status_lines[status]; 246 status_line = &ngx_http_status_lines[status];
247 len += ngx_http_status_lines[status].len; 247 len += ngx_http_status_lines[status].len;
248 248
249 } else if (status >= NGX_HTTP_BAD_REQUEST 249 } else if (status >= NGX_HTTP_BAD_REQUEST
250 && status < NGX_HTTP_LAST_LEVEL_400) 250 && status < NGX_HTTP_LAST_4XX)
251 { 251 {
252 /* 4XX */ 252 /* 4XX */
253 status = status - NGX_HTTP_BAD_REQUEST 253 status = status - NGX_HTTP_BAD_REQUEST
254 + NGX_HTTP_LEVEL_200 254 + NGX_HTTP_OFF_4XX;
255 + NGX_HTTP_LEVEL_300;
256 255
257 status_line = &ngx_http_status_lines[status]; 256 status_line = &ngx_http_status_lines[status];
258 len += ngx_http_status_lines[status].len; 257 len += ngx_http_status_lines[status].len;
259 258
260 } else if (status >= NGX_HTTP_INTERNAL_SERVER_ERROR 259 } else if (status >= NGX_HTTP_INTERNAL_SERVER_ERROR
261 && status < NGX_HTTP_LAST_LEVEL_500) 260 && status < NGX_HTTP_LAST_5XX)
262 { 261 {
263 /* 5XX */ 262 /* 5XX */
264 status = status - NGX_HTTP_INTERNAL_SERVER_ERROR 263 status = status - NGX_HTTP_INTERNAL_SERVER_ERROR
265 + NGX_HTTP_LEVEL_200 264 + NGX_HTTP_OFF_5XX;
266 + NGX_HTTP_LEVEL_300
267 + NGX_HTTP_LEVEL_400;
268 265
269 status_line = &ngx_http_status_lines[status]; 266 status_line = &ngx_http_status_lines[status];
270 len += ngx_http_status_lines[status].len; 267 len += ngx_http_status_lines[status].len;
271 268
272 } else { 269 } else {