Klaus Demo nginx / 09422e6
Renamed constants and fixed off-by-one error in "msie_padding on" handling. Ruslan Ermilov 10 years ago
1 changed file(s) with 15 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
293293
294294 ngx_null_string, /* 201, 204 */
295295
296 #define NGX_HTTP_LAST_LEVEL_200 202
297 #define NGX_HTTP_LEVEL_200 (NGX_HTTP_LAST_LEVEL_200 - 201)
296 #define NGX_HTTP_LAST_2XX 202
297 #define NGX_HTTP_OFF_3XX (NGX_HTTP_LAST_2XX - 201)
298298
299299 /* ngx_null_string, */ /* 300 */
300300 ngx_string(ngx_http_error_301_page),
301301 ngx_string(ngx_http_error_302_page),
302302 ngx_string(ngx_http_error_303_page),
303303
304 #define NGX_HTTP_LAST_LEVEL_300 304
305 #define NGX_HTTP_LEVEL_300 (NGX_HTTP_LAST_LEVEL_300 - 301)
304 #define NGX_HTTP_LAST_3XX 304
305 #define NGX_HTTP_OFF_4XX (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
306306
307307 ngx_string(ngx_http_error_400_page),
308308 ngx_string(ngx_http_error_401_page),
322322 ngx_string(ngx_http_error_415_page),
323323 ngx_string(ngx_http_error_416_page),
324324
325 #define NGX_HTTP_LAST_LEVEL_400 417
326 #define NGX_HTTP_LEVEL_400 (NGX_HTTP_LAST_LEVEL_400 - 400)
325 #define NGX_HTTP_LAST_4XX 417
326 #define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)
327327
328328 ngx_string(ngx_http_error_494_page), /* 494, request header too large */
329329 ngx_string(ngx_http_error_495_page), /* 495, https certificate error */
341341 ngx_null_string, /* 506 */
342342 ngx_string(ngx_http_error_507_page)
343343
344 #define NGX_HTTP_LAST_LEVEL_500 508
344 #define NGX_HTTP_LAST_5XX 508
345345
346346 };
347347
427427 err = 0;
428428
429429 } else if (error >= NGX_HTTP_MOVED_PERMANENTLY
430 && error < NGX_HTTP_LAST_LEVEL_300)
430 && error < NGX_HTTP_LAST_3XX)
431431 {
432432 /* 3XX */
433 err = error - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_LEVEL_200;
433 err = error - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_OFF_3XX;
434434
435435 } else if (error >= NGX_HTTP_BAD_REQUEST
436 && error < NGX_HTTP_LAST_LEVEL_400)
436 && error < NGX_HTTP_LAST_4XX)
437437 {
438438 /* 4XX */
439 err = error - NGX_HTTP_BAD_REQUEST + NGX_HTTP_LEVEL_200
440 + NGX_HTTP_LEVEL_300;
439 err = error - NGX_HTTP_BAD_REQUEST + NGX_HTTP_OFF_4XX;
441440
442441 } else if (error >= NGX_HTTP_NGINX_CODES
443 && error < NGX_HTTP_LAST_LEVEL_500)
442 && error < NGX_HTTP_LAST_5XX)
444443 {
445444 /* 49X, 5XX */
446 err = error - NGX_HTTP_NGINX_CODES + NGX_HTTP_LEVEL_200
447 + NGX_HTTP_LEVEL_300
448 + NGX_HTTP_LEVEL_400;
445 err = error - NGX_HTTP_NGINX_CODES + NGX_HTTP_OFF_5XX;
449446 switch (error) {
450447 case NGX_HTTP_TO_HTTPS:
451448 case NGX_HTTPS_CERT_ERROR:
594591
595592 return ngx_http_send_special_response(r, clcf, r->err_status
596593 - NGX_HTTP_MOVED_PERMANENTLY
597 + NGX_HTTP_LEVEL_200);
594 + NGX_HTTP_OFF_3XX);
598595 }
599596
600597
625622 if (clcf->msie_padding
626623 && (r->headers_in.msie || r->headers_in.chrome)
627624 && r->http_version >= NGX_HTTP_VERSION_10
628 && err >= NGX_HTTP_LEVEL_300)
625 && err >= NGX_HTTP_OFF_4XX)
629626 {
630627 r->headers_out.content_length_n +=
631628 sizeof(ngx_http_msie_padding) - 1;