[nginx] svn commit: r4514 - in branches/stable-1.0: . src/http src/http/modules src/http/modules/perl
mdounin at mdounin.ru
mdounin at mdounin.ru
Mon Mar 5 13:03:40 UTC 2012
Author: mdounin
Date: 2012-03-05 13:03:39 +0000 (Mon, 05 Mar 2012)
New Revision: 4514
Log:
Merge of r4491, r4492:
*) Renamed constants and fixed off-by-one error in "msie_padding on"
handling.
*) Added support for the 307 Temporary Redirect.
Modified:
branches/stable-1.0/
branches/stable-1.0/src/http/modules/ngx_http_headers_filter_module.c
branches/stable-1.0/src/http/modules/perl/nginx.pm
branches/stable-1.0/src/http/ngx_http_core_module.c
branches/stable-1.0/src/http/ngx_http_header_filter_module.c
branches/stable-1.0/src/http/ngx_http_request.h
branches/stable-1.0/src/http/ngx_http_special_response.c
Property changes on: branches/stable-1.0
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4309,4313,4315,4320-4321,4326-4327,4335-4336,4338-4343,4372-4375,4377,4379,4381-4385,4393,4396,4398,4400-4406,4413,4415-4416,4422-4423,4460-4461,4468,4470-4471,4473-4474,4493
+ /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4309,4313,4315,4320-4321,4326-4327,4335-4336,4338-4343,4372-4375,4377,4379,4381-4385,4393,4396,4398,4400-4406,4413,4415-4416,4422-4423,4460-4461,4468,4470-4471,4473-4474,4491-4493
Modified: branches/stable-1.0/src/http/modules/ngx_http_headers_filter_module.c
===================================================================
--- branches/stable-1.0/src/http/modules/ngx_http_headers_filter_module.c 2012-03-05 12:58:10 UTC (rev 4513)
+++ branches/stable-1.0/src/http/modules/ngx_http_headers_filter_module.c 2012-03-05 13:03:39 UTC (rev 4514)
@@ -149,7 +149,9 @@
&& r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT
&& r->headers_out.status != NGX_HTTP_MOVED_PERMANENTLY
&& r->headers_out.status != NGX_HTTP_MOVED_TEMPORARILY
- && r->headers_out.status != NGX_HTTP_NOT_MODIFIED))
+ && r->headers_out.status != NGX_HTTP_SEE_OTHER
+ && r->headers_out.status != NGX_HTTP_NOT_MODIFIED
+ && r->headers_out.status != NGX_HTTP_TEMPORARY_REDIRECT))
{
return ngx_http_next_header_filter(r);
}
Modified: branches/stable-1.0/src/http/modules/perl/nginx.pm
===================================================================
--- branches/stable-1.0/src/http/modules/perl/nginx.pm 2012-03-05 12:58:10 UTC (rev 4513)
+++ branches/stable-1.0/src/http/modules/perl/nginx.pm 2012-03-05 13:03:39 UTC (rev 4514)
@@ -21,7 +21,9 @@
HTTP_MOVED_PERMANENTLY
HTTP_MOVED_TEMPORARILY
HTTP_REDIRECT
+ HTTP_SEE_OTHER
HTTP_NOT_MODIFIED
+ HTTP_TEMPORARY_REDIRECT
HTTP_BAD_REQUEST
HTTP_UNAUTHORIZED
@@ -67,7 +69,9 @@
use constant HTTP_MOVED_PERMANENTLY => 301;
use constant HTTP_MOVED_TEMPORARILY => 302;
use constant HTTP_REDIRECT => 302;
+use constant HTTP_SEE_OTHER => 303;
use constant HTTP_NOT_MODIFIED => 304;
+use constant HTTP_TEMPORARY_REDIRECT => 307;
use constant HTTP_BAD_REQUEST => 400;
use constant HTTP_UNAUTHORIZED => 401;
Modified: branches/stable-1.0/src/http/ngx_http_core_module.c
===================================================================
--- branches/stable-1.0/src/http/ngx_http_core_module.c 2012-03-05 12:58:10 UTC (rev 4513)
+++ branches/stable-1.0/src/http/ngx_http_core_module.c 2012-03-05 13:03:39 UTC (rev 4514)
@@ -1798,8 +1798,11 @@
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- if (status >= NGX_HTTP_MOVED_PERMANENTLY && status <= NGX_HTTP_SEE_OTHER) {
-
+ if (status == NGX_HTTP_MOVED_PERMANENTLY
+ || status == NGX_HTTP_MOVED_TEMPORARILY
+ || status == NGX_HTTP_SEE_OTHER
+ || status == NGX_HTTP_TEMPORARY_REDIRECT)
+ {
ngx_http_clear_location(r);
r->headers_out.location = ngx_list_push(&r->headers_out.headers);
Modified: branches/stable-1.0/src/http/ngx_http_header_filter_module.c
===================================================================
--- branches/stable-1.0/src/http/ngx_http_header_filter_module.c 2012-03-05 12:58:10 UTC (rev 4513)
+++ branches/stable-1.0/src/http/ngx_http_header_filter_module.c 2012-03-05 13:03:39 UTC (rev 4514)
@@ -71,12 +71,11 @@
ngx_string("302 Moved Temporarily"),
ngx_string("303 See Other"),
ngx_string("304 Not Modified"),
+ ngx_null_string, /* "305 Use Proxy" */
+ ngx_null_string, /* "306 unused" */
+ ngx_string("307 Temporary Redirect"),
- /* ngx_null_string, */ /* "305 Use Proxy" */
- /* ngx_null_string, */ /* "306 unused" */
- /* ngx_null_string, */ /* "307 Temporary Redirect" */
-
-#define NGX_HTTP_LAST_3XX 305
+#define NGX_HTTP_LAST_3XX 308
#define NGX_HTTP_OFF_4XX (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
ngx_string("400 Bad Request"),
Modified: branches/stable-1.0/src/http/ngx_http_request.h
===================================================================
--- branches/stable-1.0/src/http/ngx_http_request.h 2012-03-05 12:58:10 UTC (rev 4513)
+++ branches/stable-1.0/src/http/ngx_http_request.h 2012-03-05 13:03:39 UTC (rev 4514)
@@ -75,6 +75,7 @@
#define NGX_HTTP_MOVED_TEMPORARILY 302
#define NGX_HTTP_SEE_OTHER 303
#define NGX_HTTP_NOT_MODIFIED 304
+#define NGX_HTTP_TEMPORARY_REDIRECT 307
#define NGX_HTTP_BAD_REQUEST 400
#define NGX_HTTP_UNAUTHORIZED 401
Modified: branches/stable-1.0/src/http/ngx_http_special_response.c
===================================================================
--- branches/stable-1.0/src/http/ngx_http_special_response.c 2012-03-05 12:58:10 UTC (rev 4513)
+++ branches/stable-1.0/src/http/ngx_http_special_response.c 2012-03-05 13:03:39 UTC (rev 4514)
@@ -74,6 +74,14 @@
;
+static char ngx_http_error_307_page[] =
+"<html>" CRLF
+"<head><title>307 Temporary Redirect</title></head>" CRLF
+"<body bgcolor=\"white\">" CRLF
+"<center><h1>307 Temporary Redirect</h1></center>" CRLF
+;
+
+
static char ngx_http_error_400_page[] =
"<html>" CRLF
"<head><title>400 Bad Request</title></head>" CRLF
@@ -294,16 +302,20 @@
ngx_null_string, /* 201, 204 */
-#define NGX_HTTP_LAST_LEVEL_200 202
-#define NGX_HTTP_LEVEL_200 (NGX_HTTP_LAST_LEVEL_200 - 201)
+#define NGX_HTTP_LAST_2XX 202
+#define NGX_HTTP_OFF_3XX (NGX_HTTP_LAST_2XX - 201)
/* ngx_null_string, */ /* 300 */
ngx_string(ngx_http_error_301_page),
ngx_string(ngx_http_error_302_page),
ngx_string(ngx_http_error_303_page),
+ ngx_null_string, /* 304 */
+ ngx_null_string, /* 305 */
+ ngx_null_string, /* 306 */
+ ngx_string(ngx_http_error_307_page),
-#define NGX_HTTP_LAST_LEVEL_300 304
-#define NGX_HTTP_LEVEL_300 (NGX_HTTP_LAST_LEVEL_300 - 301)
+#define NGX_HTTP_LAST_3XX 308
+#define NGX_HTTP_OFF_4XX (NGX_HTTP_LAST_3XX - 301 + NGX_HTTP_OFF_3XX)
ngx_string(ngx_http_error_400_page),
ngx_string(ngx_http_error_401_page),
@@ -323,8 +335,8 @@
ngx_string(ngx_http_error_415_page),
ngx_string(ngx_http_error_416_page),
-#define NGX_HTTP_LAST_LEVEL_400 417
-#define NGX_HTTP_LEVEL_400 (NGX_HTTP_LAST_LEVEL_400 - 400)
+#define NGX_HTTP_LAST_4XX 417
+#define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX)
ngx_string(ngx_http_error_494_page), /* 494, request header too large */
ngx_string(ngx_http_error_495_page), /* 495, https certificate error */
@@ -342,7 +354,7 @@
ngx_null_string, /* 506 */
ngx_string(ngx_http_error_507_page)
-#define NGX_HTTP_LAST_LEVEL_500 508
+#define NGX_HTTP_LAST_5XX 508
};
@@ -428,25 +440,22 @@
err = 0;
} else if (error >= NGX_HTTP_MOVED_PERMANENTLY
- && error < NGX_HTTP_LAST_LEVEL_300)
+ && error < NGX_HTTP_LAST_3XX)
{
/* 3XX */
- err = error - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_LEVEL_200;
+ err = error - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_OFF_3XX;
} else if (error >= NGX_HTTP_BAD_REQUEST
- && error < NGX_HTTP_LAST_LEVEL_400)
+ && error < NGX_HTTP_LAST_4XX)
{
/* 4XX */
- err = error - NGX_HTTP_BAD_REQUEST + NGX_HTTP_LEVEL_200
- + NGX_HTTP_LEVEL_300;
+ err = error - NGX_HTTP_BAD_REQUEST + NGX_HTTP_OFF_4XX;
} else if (error >= NGX_HTTP_NGINX_CODES
- && error < NGX_HTTP_LAST_LEVEL_500)
+ && error < NGX_HTTP_LAST_5XX)
{
/* 49X, 5XX */
- err = error - NGX_HTTP_NGINX_CODES + NGX_HTTP_LEVEL_200
- + NGX_HTTP_LEVEL_300
- + NGX_HTTP_LEVEL_400;
+ err = error - NGX_HTTP_NGINX_CODES + NGX_HTTP_OFF_5XX;
switch (error) {
case NGX_HTTP_TO_HTTPS:
case NGX_HTTPS_CERT_ERROR:
@@ -570,12 +579,11 @@
return NGX_ERROR;
}
- if (overwrite >= NGX_HTTP_MOVED_PERMANENTLY
- && overwrite <= NGX_HTTP_SEE_OTHER)
+ if (overwrite != NGX_HTTP_MOVED_PERMANENTLY
+ && overwrite != NGX_HTTP_MOVED_TEMPORARILY
+ && overwrite != NGX_HTTP_SEE_OTHER
+ && overwrite != NGX_HTTP_TEMPORARY_REDIRECT)
{
- r->err_status = overwrite;
-
- } else {
r->err_status = NGX_HTTP_MOVED_TEMPORARILY;
}
@@ -595,7 +603,7 @@
return ngx_http_send_special_response(r, clcf, r->err_status
- NGX_HTTP_MOVED_PERMANENTLY
- + NGX_HTTP_LEVEL_200);
+ + NGX_HTTP_OFF_3XX);
}
@@ -626,7 +634,7 @@
if (clcf->msie_padding
&& (r->headers_in.msie || r->headers_in.chrome)
&& r->http_version >= NGX_HTTP_VERSION_10
- && err >= NGX_HTTP_LEVEL_300)
+ && err >= NGX_HTTP_OFF_4XX)
{
r->headers_out.content_length_n +=
sizeof(ngx_http_msie_padding) - 1;
More information about the nginx-devel
mailing list