Mercurial > hg > nginx-quic
annotate src/http/ngx_http_special_response.c @ 1628:8d3d224cae20
style and grammar fix
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 09 Nov 2007 13:12:25 +0000 |
parents | e27930ae2b8f |
children | bc93d5ab3e27 |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
416
diff
changeset
|
5 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
6 |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
7 #include <ngx_config.h> |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
96
diff
changeset
|
8 #include <ngx_core.h> |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
9 #include <ngx_http.h> |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
10 #include <nginx.h> |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
13 static ngx_int_t ngx_http_send_error_page(ngx_http_request_t *r, |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
14 ngx_http_err_page_t *err_page); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
15 static ngx_int_t ngx_http_send_special_response(ngx_http_request_t *r, |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
16 ngx_http_core_loc_conf_t *clcf, ngx_uint_t err); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
17 static ngx_int_t ngx_http_send_refresh(ngx_http_request_t *r); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
18 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
19 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
20 static u_char ngx_http_error_full_tail[] = |
1592 | 21 "<hr><center>" NGINX_VER "</center>" CRLF |
22 "</body>" CRLF | |
23 "</html>" CRLF | |
24 ; | |
25 | |
26 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
27 static u_char ngx_http_error_tail[] = |
1592 | 28 "<hr><center>nginx</center>" CRLF |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
29 "</body>" CRLF |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
30 "</html>" CRLF |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
31 ; |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
32 |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
33 |
501 | 34 static u_char ngx_http_msie_stub[] = |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
35 "<!-- The padding to disable MSIE's friendly error page -->" CRLF |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
36 "<!-- The padding to disable MSIE's friendly error page -->" CRLF |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
37 "<!-- The padding to disable MSIE's friendly error page -->" CRLF |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
38 "<!-- The padding to disable MSIE's friendly error page -->" CRLF |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
39 "<!-- The padding to disable MSIE's friendly error page -->" CRLF |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
40 "<!-- The padding to disable MSIE's friendly error page -->" CRLF |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
41 ; |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
42 |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
43 |
679 | 44 static u_char ngx_http_msie_refresh_head[] = |
45 "<html><head><meta http-equiv=\"Refresh\" content=\"0; URL="; | |
46 | |
47 | |
48 static u_char ngx_http_msie_refresh_tail[] = | |
49 "\"></head><body></body></html>" CRLF; | |
50 | |
51 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
52 static char ngx_http_error_301_page[] = |
144
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
53 "<html>" CRLF |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
54 "<head><title>301 Moved Permanently</title></head>" CRLF |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
55 "<body bgcolor=\"white\">" CRLF |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
56 "<center><h1>301 Moved Permanently</h1></center>" CRLF |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
57 ; |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
58 |
ef8c87afcfc5
nginx-0.0.1-2003-10-12-20:49:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
143
diff
changeset
|
59 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
60 static char ngx_http_error_302_page[] = |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
61 "<html>" CRLF |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
62 "<head><title>302 Found</title></head>" CRLF |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
63 "<body bgcolor=\"white\">" CRLF |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
64 "<center><h1>302 Found</h1></center>" CRLF |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
65 ; |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
66 |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
67 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
68 static char ngx_http_error_400_page[] = |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
69 "<html>" CRLF |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
70 "<head><title>400 Bad Request</title></head>" CRLF |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
71 "<body bgcolor=\"white\">" CRLF |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
72 "<center><h1>400 Bad Request</h1></center>" CRLF |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
73 ; |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
74 |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
75 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
76 static char ngx_http_error_401_page[] = |
499 | 77 "<html>" CRLF |
503 | 78 "<head><title>401 Authorization Required</title></head>" CRLF |
499 | 79 "<body bgcolor=\"white\">" CRLF |
503 | 80 "<center><h1>401 Authorization Required</h1></center>" CRLF |
499 | 81 ; |
82 | |
83 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
84 static char ngx_http_error_402_page[] = |
499 | 85 "<html>" CRLF |
86 "<head><title>402 Payment Required</title></head>" CRLF | |
87 "<body bgcolor=\"white\">" CRLF | |
88 "<center><h1>402 Payment Required</h1></center>" CRLF | |
89 ; | |
90 | |
91 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
92 static char ngx_http_error_403_page[] = |
45
f1ee46c036a4
nginx-0.0.1-2003-01-10-09:09:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
93 "<html>" CRLF |
f1ee46c036a4
nginx-0.0.1-2003-01-10-09:09:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
94 "<head><title>403 Forbidden</title></head>" CRLF |
f1ee46c036a4
nginx-0.0.1-2003-01-10-09:09:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
95 "<body bgcolor=\"white\">" CRLF |
f1ee46c036a4
nginx-0.0.1-2003-01-10-09:09:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
96 "<center><h1>403 Forbidden</h1></center>" CRLF |
f1ee46c036a4
nginx-0.0.1-2003-01-10-09:09:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
97 ; |
f1ee46c036a4
nginx-0.0.1-2003-01-10-09:09:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
98 |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
99 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
100 static char ngx_http_error_404_page[] = |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
101 "<html>" CRLF |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
102 "<head><title>404 Not Found</title></head>" CRLF |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
103 "<body bgcolor=\"white\">" CRLF |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
104 "<center><h1>404 Not Found</h1></center>" CRLF |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
105 ; |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
106 |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
107 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
108 static char ngx_http_error_405_page[] = |
96
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
109 "<html>" CRLF |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
110 "<head><title>405 Not Allowed</title></head>" CRLF |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
111 "<body bgcolor=\"white\">" CRLF |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
112 "<center><h1>405 Not Allowed</h1></center>" CRLF |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
113 ; |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
114 |
a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
88
diff
changeset
|
115 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
116 static char ngx_http_error_406_page[] = |
499 | 117 "<html>" CRLF |
118 "<head><title>406 Not Acceptable</title></head>" CRLF | |
119 "<body bgcolor=\"white\">" CRLF | |
120 "<center><h1>406 Not Acceptable</h1></center>" CRLF | |
121 ; | |
122 | |
123 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
124 static char ngx_http_error_408_page[] = |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
125 "<html>" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
126 "<head><title>408 Request Time-out</title></head>" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
127 "<body bgcolor=\"white\">" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
128 "<center><h1>408 Request Time-out</h1></center>" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
129 ; |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
130 |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
131 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
132 static char ngx_http_error_409_page[] = |
637 | 133 "<html>" CRLF |
134 "<head><title>409 Conflict</title></head>" CRLF | |
135 "<body bgcolor=\"white\">" CRLF | |
136 "<center><h1>409 Conflict</h1></center>" CRLF | |
137 ; | |
138 | |
139 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
140 static char ngx_http_error_410_page[] = |
499 | 141 "<html>" CRLF |
142 "<head><title>410 Gone</title></head>" CRLF | |
143 "<body bgcolor=\"white\">" CRLF | |
144 "<center><h1>410 Gone</h1></center>" CRLF | |
145 ; | |
146 | |
147 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
148 static char ngx_http_error_411_page[] = |
581 | 149 "<html>" CRLF |
150 "<head><title>411 Length Required</title></head>" CRLF | |
151 "<body bgcolor=\"white\">" CRLF | |
152 "<center><h1>411 Length Required</h1></center>" CRLF | |
153 ; | |
154 | |
155 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
156 static char ngx_http_error_412_page[] = |
1057 | 157 "<html>" CRLF |
158 "<head><title>412 Precondition Failed</title></head>" CRLF | |
159 "<body bgcolor=\"white\">" CRLF | |
160 "<center><h1>412 Precondition Failed</h1></center>" CRLF | |
161 ; | |
162 | |
163 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
164 static char ngx_http_error_413_page[] = |
162
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
165 "<html>" CRLF |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
166 "<head><title>413 Request Entity Too Large</title></head>" CRLF |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
167 "<body bgcolor=\"white\">" CRLF |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
168 "<center><h1>413 Request Entity Too Large</h1></center>" CRLF |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
169 ; |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
170 |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
171 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
172 static char ngx_http_error_414_page[] = |
67
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
173 "<html>" CRLF |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
174 "<head><title>414 Request-URI Too Large</title></head>" CRLF |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
175 "<body bgcolor=\"white\">" CRLF |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
176 "<center><h1>414 Request-URI Too Large</h1></center>" CRLF |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
177 ; |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
178 |
5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
59
diff
changeset
|
179 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
180 static char ngx_http_error_415_page[] = |
637 | 181 "<html>" CRLF |
182 "<head><title>415 Unsupported Media Type</title></head>" CRLF | |
183 "<body bgcolor=\"white\">" CRLF | |
184 "<center><h1>415 Unsupported Media Type</h1></center>" CRLF | |
185 ; | |
186 | |
187 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
188 static char ngx_http_error_416_page[] = |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
189 "<html>" CRLF |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
190 "<head><title>416 Requested Range Not Satisfiable</title></head>" CRLF |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
191 "<body bgcolor=\"white\">" CRLF |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
192 "<center><h1>416 Requested Range Not Satisfiable</h1></center>" CRLF |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
193 ; |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
194 |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
195 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
196 static char ngx_http_error_495_page[] = |
647 | 197 "<html>" CRLF |
198 "<head><title>400 The SSL certificate error</title></head>" | |
199 CRLF | |
200 "<body bgcolor=\"white\">" CRLF | |
201 "<center><h1>400 Bad Request</h1></center>" CRLF | |
202 "<center>The SSL certificate error</center>" CRLF | |
203 ; | |
204 | |
205 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
206 static char ngx_http_error_496_page[] = |
647 | 207 "<html>" CRLF |
208 "<head><title>400 No required SSL certificate was sent</title></head>" | |
209 CRLF | |
210 "<body bgcolor=\"white\">" CRLF | |
211 "<center><h1>400 Bad Request</h1></center>" CRLF | |
212 "<center>No required SSL certificate was sent</center>" CRLF | |
213 ; | |
214 | |
215 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
216 static char ngx_http_error_497_page[] = |
384
e7054aaedf68
nginx-0.0.7-2004-07-09-11:12:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
217 "<html>" CRLF |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
384
diff
changeset
|
218 "<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>" |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
384
diff
changeset
|
219 CRLF |
384
e7054aaedf68
nginx-0.0.7-2004-07-09-11:12:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
220 "<body bgcolor=\"white\">" CRLF |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
384
diff
changeset
|
221 "<center><h1>400 Bad Request</h1></center>" CRLF |
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
384
diff
changeset
|
222 "<center>The plain HTTP request was sent to HTTPS port</center>" CRLF |
384
e7054aaedf68
nginx-0.0.7-2004-07-09-11:12:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
223 ; |
e7054aaedf68
nginx-0.0.7-2004-07-09-11:12:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
224 |
e7054aaedf68
nginx-0.0.7-2004-07-09-11:12:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
225 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
226 static char ngx_http_error_500_page[] = |
47
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
227 "<html>" CRLF |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
228 "<head><title>500 Internal Server Error</title></head>" CRLF |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
229 "<body bgcolor=\"white\">" CRLF |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
230 "<center><h1>500 Internal Server Error</h1></center>" CRLF |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
231 ; |
d81326c3b21b
nginx-0.0.1-2003-01-15-10:02:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
45
diff
changeset
|
232 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
233 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
234 static char ngx_http_error_501_page[] = |
233
4eaafcd57be7
nginx-0.0.1-2004-01-19-21:09:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
235 "<html>" CRLF |
4eaafcd57be7
nginx-0.0.1-2004-01-19-21:09:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
236 "<head><title>501 Method Not Implemented</title></head>" CRLF |
4eaafcd57be7
nginx-0.0.1-2004-01-19-21:09:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
237 "<body bgcolor=\"white\">" CRLF |
535 | 238 "<center><h1>501 Method Not Implemented</h1></center>" CRLF |
233
4eaafcd57be7
nginx-0.0.1-2004-01-19-21:09:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
239 ; |
4eaafcd57be7
nginx-0.0.1-2004-01-19-21:09:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
240 |
4eaafcd57be7
nginx-0.0.1-2004-01-19-21:09:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
241 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
242 static char ngx_http_error_502_page[] = |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
243 "<html>" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
244 "<head><title>502 Bad Gateway</title></head>" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
245 "<body bgcolor=\"white\">" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
246 "<center><h1>502 Bad Gateway</h1></center>" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
247 ; |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
248 |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
249 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
250 static char ngx_http_error_503_page[] = |
162
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
251 "<html>" CRLF |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
252 "<head><title>503 Service Temporarily Unavailable</title></head>" CRLF |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
253 "<body bgcolor=\"white\">" CRLF |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
254 "<center><h1>503 Service Temporarily Unavailable</h1></center>" CRLF |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
255 ; |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
256 |
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
257 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
258 static char ngx_http_error_504_page[] = |
69
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
259 "<html>" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
260 "<head><title>504 Gateway Time-out</title></head>" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
261 "<body bgcolor=\"white\">" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
262 "<center><h1>504 Gateway Time-out</h1></center>" CRLF |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
263 ; |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
264 |
e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents:
68
diff
changeset
|
265 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
266 static char ngx_http_error_507_page[] = |
637 | 267 "<html>" CRLF |
268 "<head><title>507 Insufficient Storage</title></head>" CRLF | |
269 "<body bgcolor=\"white\">" CRLF | |
270 "<center><h1>507 Insufficient Storage</h1></center>" CRLF | |
271 ; | |
272 | |
273 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
274 static ngx_str_t ngx_http_error_pages[] = { |
499 | 275 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
276 ngx_null_string, /* 201, 204 */ |
511 | 277 |
278 #define NGX_HTTP_LEVEL_200 1 | |
279 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
280 /* ngx_null_string, */ /* 300 */ |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
281 ngx_string(ngx_http_error_301_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
282 ngx_string(ngx_http_error_302_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
283 ngx_null_string, /* 303 */ |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
284 |
499 | 285 #define NGX_HTTP_LEVEL_300 3 |
286 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
287 ngx_string(ngx_http_error_400_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
288 ngx_string(ngx_http_error_401_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
289 ngx_string(ngx_http_error_402_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
290 ngx_string(ngx_http_error_403_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
291 ngx_string(ngx_http_error_404_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
292 ngx_string(ngx_http_error_405_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
293 ngx_string(ngx_http_error_406_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
294 ngx_null_string, /* 407 */ |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
295 ngx_string(ngx_http_error_408_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
296 ngx_string(ngx_http_error_409_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
297 ngx_string(ngx_http_error_410_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
298 ngx_string(ngx_http_error_411_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
299 ngx_string(ngx_http_error_412_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
300 ngx_string(ngx_http_error_413_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
301 ngx_string(ngx_http_error_414_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
302 ngx_string(ngx_http_error_415_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
303 ngx_string(ngx_http_error_416_page), |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
304 |
499 | 305 #define NGX_HTTP_LEVEL_400 17 |
306 | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
307 ngx_string(ngx_http_error_495_page), /* 495, https certificate error */ |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
308 ngx_string(ngx_http_error_496_page), /* 496, https no certificate */ |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
309 ngx_string(ngx_http_error_497_page), /* 497, http to https */ |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
310 ngx_string(ngx_http_error_404_page), /* 498, invalid host name */ |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
311 ngx_null_string, /* 499, client has closed connection */ |
335
d4241d7787fe
nginx-0.0.3-2004-05-14-20:51:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
331
diff
changeset
|
312 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
313 ngx_string(ngx_http_error_500_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
314 ngx_string(ngx_http_error_501_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
315 ngx_string(ngx_http_error_502_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
316 ngx_string(ngx_http_error_503_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
317 ngx_string(ngx_http_error_504_page), |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
318 ngx_null_string, /* 505 */ |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
319 ngx_null_string, /* 506 */ |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
320 ngx_string(ngx_http_error_507_page) |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
321 }; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
322 |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
47
diff
changeset
|
323 |
717
08652aae6fab
fix msvc build failure introduced by previous commit
Igor Sysoev <igor@sysoev.ru>
parents:
716
diff
changeset
|
324 static ngx_str_t ngx_http_get_name = { 3, (u_char *) "GET " }; |
716
d8d7c39e3a76
allowing handling 400 errors via proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
681
diff
changeset
|
325 |
d8d7c39e3a76
allowing handling 400 errors via proxy_pass
Igor Sysoev <igor@sysoev.ru>
parents:
681
diff
changeset
|
326 |
487 | 327 ngx_int_t |
328 ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error) | |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
329 { |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
233
diff
changeset
|
330 ngx_int_t rc; |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
331 ngx_uint_t i, err; |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
332 ngx_http_err_page_t *err_page; |
158
d377ee423603
nginx-0.0.1-2003-10-24-10:53:41 import
Igor Sysoev <igor@sysoev.ru>
parents:
155
diff
changeset
|
333 ngx_http_core_loc_conf_t *clcf; |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
334 |
527 | 335 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
336 "http special response: %d, \"%V\"", error, &r->uri); | |
337 | |
1370
cc114c85be0f
rename ngx_http_discard_body() to ngx_http_discard_request_body()
Igor Sysoev <igor@sysoev.ru>
parents:
1353
diff
changeset
|
338 rc = ngx_http_discard_request_body(r); |
161
88abd07d9f62
nginx-0.0.1-2003-10-27-19:16:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
339 |
294
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
340 if (rc == NGX_HTTP_INTERNAL_SERVER_ERROR) { |
5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
293
diff
changeset
|
341 error = NGX_HTTP_INTERNAL_SERVER_ERROR; |
161
88abd07d9f62
nginx-0.0.1-2003-10-27-19:16:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
342 } |
88abd07d9f62
nginx-0.0.1-2003-10-27-19:16:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
158
diff
changeset
|
343 |
677 | 344 r->err_status = error; |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
345 |
68
d549fdc17d7e
nginx-0.0.1-2003-03-12-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
346 if (r->keepalive != 0) { |
d549fdc17d7e
nginx-0.0.1-2003-03-12-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
347 switch (error) { |
d549fdc17d7e
nginx-0.0.1-2003-03-12-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
348 case NGX_HTTP_BAD_REQUEST: |
162
96993d4d5067
nginx-0.0.1-2003-10-28-00:01:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
161
diff
changeset
|
349 case NGX_HTTP_REQUEST_ENTITY_TOO_LARGE: |
68
d549fdc17d7e
nginx-0.0.1-2003-03-12-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
350 case NGX_HTTP_REQUEST_URI_TOO_LARGE: |
384
e7054aaedf68
nginx-0.0.7-2004-07-09-11:12:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
351 case NGX_HTTP_TO_HTTPS: |
647 | 352 case NGX_HTTPS_CERT_ERROR: |
353 case NGX_HTTPS_NO_CERT: | |
68
d549fdc17d7e
nginx-0.0.1-2003-03-12-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
354 case NGX_HTTP_INTERNAL_SERVER_ERROR: |
d549fdc17d7e
nginx-0.0.1-2003-03-12-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
355 r->keepalive = 0; |
d549fdc17d7e
nginx-0.0.1-2003-03-12-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
356 } |
d549fdc17d7e
nginx-0.0.1-2003-03-12-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
357 } |
d549fdc17d7e
nginx-0.0.1-2003-03-12-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
358 |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
359 if (r->lingering_close == 1) { |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
360 switch (error) { |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
361 case NGX_HTTP_BAD_REQUEST: |
384
e7054aaedf68
nginx-0.0.7-2004-07-09-11:12:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
362 case NGX_HTTP_TO_HTTPS: |
647 | 363 case NGX_HTTPS_CERT_ERROR: |
364 case NGX_HTTPS_NO_CERT: | |
88
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
365 r->lingering_close = 0; |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
366 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
367 } |
674d333f4296
nginx-0.0.1-2003-05-14-21:13:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
71
diff
changeset
|
368 |
675 | 369 r->headers_out.content_type.len = 0; |
370 | |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
371 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
372 |
679 | 373 if (!r->error_page && clcf->error_pages) { |
374 | |
375 if (clcf->recursive_error_pages == 0) { | |
376 r->error_page = 1; | |
377 } | |
477 | 378 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
379 err_page = clcf->error_pages->elts; |
477 | 380 |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
381 for (i = 0; i < clcf->error_pages->nelts; i++) { |
326
8733703a37f3
nginx-0.0.3-2004-04-26-00:13:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
323
diff
changeset
|
382 if (err_page[i].status == error) { |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
383 return ngx_http_send_error_page(r, &err_page[i]); |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
384 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
385 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
386 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
387 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
388 if (clcf->msie_refresh |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
389 && r->headers_in.msie |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
390 && (error == NGX_HTTP_MOVED_PERMANENTLY |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
391 || error == NGX_HTTP_MOVED_TEMPORARILY)) |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
392 { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
393 return ngx_http_send_refresh(r); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
394 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
395 |
633 | 396 if (error == NGX_HTTP_CREATED) { |
397 /* 201 */ | |
398 err = 0; | |
637 | 399 r->header_only = 1; |
633 | 400 |
401 } else if (error == NGX_HTTP_NO_CONTENT) { | |
511 | 402 /* 204 */ |
403 err = 0; | |
404 | |
405 } else if (error < NGX_HTTP_BAD_REQUEST) { | |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
406 /* 3XX */ |
513 | 407 err = error - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_LEVEL_200; |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
408 |
587 | 409 } else if (error < NGX_HTTP_OWN_CODES) { |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
410 /* 4XX */ |
511 | 411 err = error - NGX_HTTP_BAD_REQUEST + NGX_HTTP_LEVEL_200 |
412 + NGX_HTTP_LEVEL_300; | |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
413 |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
414 } else { |
335
d4241d7787fe
nginx-0.0.3-2004-05-14-20:51:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
331
diff
changeset
|
415 /* 49X, 5XX */ |
587 | 416 err = error - NGX_HTTP_OWN_CODES + NGX_HTTP_LEVEL_200 |
511 | 417 + NGX_HTTP_LEVEL_300 |
499 | 418 + NGX_HTTP_LEVEL_400; |
335
d4241d7787fe
nginx-0.0.3-2004-05-14-20:51:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
331
diff
changeset
|
419 switch (error) { |
384
e7054aaedf68
nginx-0.0.7-2004-07-09-11:12:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
420 case NGX_HTTP_TO_HTTPS: |
647 | 421 case NGX_HTTPS_CERT_ERROR: |
422 case NGX_HTTPS_NO_CERT: | |
679 | 423 r->err_status = NGX_HTTP_BAD_REQUEST; |
384
e7054aaedf68
nginx-0.0.7-2004-07-09-11:12:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
356
diff
changeset
|
424 break; |
335
d4241d7787fe
nginx-0.0.3-2004-05-14-20:51:47 import
Igor Sysoev <igor@sysoev.ru>
parents:
331
diff
changeset
|
425 } |
176
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
426 } |
c0552e5ab567
nginx-0.0.1-2003-11-09-23:03:38 import; separate building
Igor Sysoev <igor@sysoev.ru>
parents:
165
diff
changeset
|
427 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
428 return ngx_http_send_special_response(r, clcf, err); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
429 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
430 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
431 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
432 static ngx_int_t |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
433 ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page) |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
434 { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
435 u_char ch, *p, *last; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
436 ngx_str_t *uri, *args, u, a; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
437 ngx_table_elt_t *location; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
438 ngx_http_core_loc_conf_t *clcf; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
439 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
440 r->err_status = err_page->overwrite; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
441 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
442 r->method = NGX_HTTP_GET; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
443 r->method_name = ngx_http_get_name; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
444 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
445 r->zero_in_uri = 0; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
446 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
447 args = NULL; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
448 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
449 if (err_page->uri_lengths) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
450 if (ngx_http_script_run(r, &u, err_page->uri_lengths->elts, 0, |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
451 err_page->uri_values->elts) |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
452 == NULL) |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
453 { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
454 return NGX_ERROR; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
455 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
456 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
457 p = u.data; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
458 uri = &u; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
459 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
460 if (*p == '/') { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
461 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
462 last = p + uri->len; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
463 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
464 while (p < last) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
465 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
466 ch = *p++; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
467 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
468 if (ch == '?') { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
469 a.len = last - p; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
470 a.data = p; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
471 args = &a; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
472 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
473 u.len = p - 1 - u.data; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
474 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
475 while (p < last) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
476 if (*p++ == '\0') { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
477 r->zero_in_uri = 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
478 break; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
479 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
480 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
481 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
482 break; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
483 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
484 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
485 if (ch == '\0') { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
486 r->zero_in_uri = 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
487 continue; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
488 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
489 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
490 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
491 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
492 } else { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
493 uri = &err_page->uri; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
494 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
495 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
496 if (uri->data[0] == '/') { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
497 return ngx_http_internal_redirect(r, uri, args); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
498 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
499 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
500 if (uri->data[0] == '@') { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
501 return ngx_http_named_location(r, uri); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
502 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
503 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
504 location = ngx_list_push(&r->headers_out.headers); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
505 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
506 if (location == NULL) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
507 return NGX_ERROR; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
508 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
509 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
510 r->err_status = NGX_HTTP_MOVED_TEMPORARILY; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
511 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
512 location->hash = 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
513 location->key.len = sizeof("Location") - 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
514 location->key.data = (u_char *) "Location"; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
515 location->value = *uri; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
516 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
517 r->headers_out.location = location; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
518 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
519 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
520 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
521 if (clcf->msie_refresh && r->headers_in.msie) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
522 return ngx_http_send_refresh(r); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
523 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
524 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
525 return ngx_http_send_special_response(r, clcf, NGX_HTTP_MOVED_TEMPORARILY |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
526 - NGX_HTTP_MOVED_PERMANENTLY |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
527 + NGX_HTTP_LEVEL_200); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
528 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
529 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
530 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
531 static ngx_int_t |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
532 ngx_http_send_special_response(ngx_http_request_t *r, |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
533 ngx_http_core_loc_conf_t *clcf, ngx_uint_t err) |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
534 { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
535 u_char *tail; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
536 size_t len; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
537 ngx_int_t rc; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
538 ngx_buf_t *b; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
539 ngx_uint_t msie_padding; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
540 ngx_chain_t out[3]; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
541 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
542 if (clcf->server_tokens) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
543 len = sizeof(ngx_http_error_full_tail) - 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
544 tail = ngx_http_error_full_tail; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
545 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
546 } else { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
547 len = sizeof(ngx_http_error_tail) - 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
548 tail = ngx_http_error_tail; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
549 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
550 |
356
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
551 msie_padding = 0; |
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
343
diff
changeset
|
552 |
730
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
553 if (!r->zero_body) { |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
554 if (ngx_http_error_pages[err].len) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
555 r->headers_out.content_length_n = ngx_http_error_pages[err].len |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
556 + len; |
730
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
557 if (clcf->msie_padding |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
558 && r->headers_in.msie |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
559 && r->http_version >= NGX_HTTP_VERSION_10 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
560 && err >= NGX_HTTP_LEVEL_300) |
730
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
561 { |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
562 r->headers_out.content_length_n += |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
563 sizeof(ngx_http_msie_stub) - 1; |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
564 msie_padding = 1; |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
565 } |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
566 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
567 r->headers_out.content_type_len = sizeof("text/html") - 1; |
730
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
568 r->headers_out.content_type.len = sizeof("text/html") - 1; |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
569 r->headers_out.content_type.data = (u_char *) "text/html"; |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
570 |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
571 } else { |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
572 r->headers_out.content_length_n = -1; |
331
f168a88e93f7
nginx-0.0.3-2004-05-04-21:56:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
326
diff
changeset
|
573 } |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
98
diff
changeset
|
574 |
68
d549fdc17d7e
nginx-0.0.1-2003-03-12-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
575 } else { |
730
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
576 r->headers_out.content_length_n = 0; |
1be87cdd010f
set "Content-Length: 0" for errors handled by "return 204"
Igor Sysoev <igor@sysoev.ru>
parents:
717
diff
changeset
|
577 err = 0; |
165
894a01c6aea3
nginx-0.0.1-2003-10-29-20:39:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
578 } |
894a01c6aea3
nginx-0.0.1-2003-10-29-20:39:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
579 |
894a01c6aea3
nginx-0.0.1-2003-10-29-20:39:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
164
diff
changeset
|
580 if (r->headers_out.content_length) { |
509 | 581 r->headers_out.content_length->hash = 0; |
153
c71aeb75c071
nginx-0.0.1-2003-10-21-20:49:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
148
diff
changeset
|
582 r->headers_out.content_length = NULL; |
68
d549fdc17d7e
nginx-0.0.1-2003-03-12-20:32:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
67
diff
changeset
|
583 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
584 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
585 ngx_http_clear_accept_ranges(r); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
586 ngx_http_clear_last_modified(r); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
587 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
588 rc = ngx_http_send_header(r); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
589 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
590 if (rc == NGX_ERROR || r->header_only) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
591 return rc; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
592 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
593 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
594 if (ngx_http_error_pages[err].len == 0) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
595 return NGX_OK; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
596 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
597 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
598 b = ngx_calloc_buf(r->pool); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
599 if (b == NULL) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
600 return NGX_ERROR; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
601 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
602 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
603 b->memory = 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
604 b->pos = ngx_http_error_pages[err].data; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
605 b->last = ngx_http_error_pages[err].data + ngx_http_error_pages[err].len; |
1298
458e041fc902
msie_refresh should escape at least '"' to prevent XSS
Igor Sysoev <igor@sysoev.ru>
parents:
1057
diff
changeset
|
606 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
607 out[0].buf = b; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
608 out[0].next = &out[1]; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
609 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
610 b = ngx_calloc_buf(r->pool); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
611 if (b == NULL) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
612 return NGX_ERROR; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
613 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
614 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
615 b->memory = 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
616 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
617 b->pos = tail; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
618 b->last = tail + len; |
1298
458e041fc902
msie_refresh should escape at least '"' to prevent XSS
Igor Sysoev <igor@sysoev.ru>
parents:
1057
diff
changeset
|
619 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
620 out[1].buf = b; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
621 out[1].next = NULL;; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
622 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
623 if (msie_padding) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
624 b = ngx_calloc_buf(r->pool); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
625 if (b == NULL) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
626 return NGX_ERROR; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
627 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
628 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
629 b->memory = 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
630 b->pos = ngx_http_msie_stub; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
631 b->last = ngx_http_msie_stub + sizeof(ngx_http_msie_stub) - 1; |
1298
458e041fc902
msie_refresh should escape at least '"' to prevent XSS
Igor Sysoev <igor@sysoev.ru>
parents:
1057
diff
changeset
|
632 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
633 out[1].next = &out[2]; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
634 out[2].buf = b; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
635 out[2].next = NULL;; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
636 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
637 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
638 if (r == r->main) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
639 b->last_buf = 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
640 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
641 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
642 b->last_in_chain = 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
643 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
644 return ngx_http_output_filter(r, &out[0]); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
645 } |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
646 |
679 | 647 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
648 static ngx_int_t |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
649 ngx_http_send_refresh(ngx_http_request_t *r) |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
650 { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
651 u_char *p, *location; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
652 size_t len, size; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
653 uintptr_t escape; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
654 ngx_int_t rc; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
655 ngx_buf_t *b; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
656 ngx_chain_t out; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
657 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
658 len = r->headers_out.location->value.len; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
659 location = r->headers_out.location->value.data; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
660 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
661 escape = 2 * ngx_escape_uri(NULL, location, len, NGX_ESCAPE_REFRESH); |
1298
458e041fc902
msie_refresh should escape at least '"' to prevent XSS
Igor Sysoev <igor@sysoev.ru>
parents:
1057
diff
changeset
|
662 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
663 size = sizeof(ngx_http_msie_refresh_head) - 1 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
664 + escape + len |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
665 + sizeof(ngx_http_msie_refresh_tail) - 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
666 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
667 r->err_status = NGX_HTTP_OK; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
668 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
669 r->headers_out.content_type_len = sizeof("text/html") - 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
670 r->headers_out.content_type.len = sizeof("text/html") - 1; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
671 r->headers_out.content_type.data = (u_char *) "text/html"; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
672 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
673 r->headers_out.location->hash = 0; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
674 r->headers_out.location = NULL; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
675 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
676 r->headers_out.content_length_n = size; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
677 |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
678 if (r->headers_out.content_length) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
679 r->headers_out.content_length->hash = 0; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
680 r->headers_out.content_length = NULL; |
679 | 681 } |
682 | |
577 | 683 ngx_http_clear_accept_ranges(r); |
684 ngx_http_clear_last_modified(r); | |
685 | |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
686 rc = ngx_http_send_header(r); |
142
cb77c084acdb
nginx-0.0.1-2003-10-09-11:00:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
103
diff
changeset
|
687 |
143
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
142
diff
changeset
|
688 if (rc == NGX_ERROR || r->header_only) { |
5526213be452
nginx-0.0.1-2003-10-10-19:10:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
142
diff
changeset
|
689 return rc; |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
690 } |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
691 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
692 b = ngx_create_temp_buf(r->pool, size); |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
693 if (b == NULL) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
694 return NGX_ERROR; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
695 } |
1592 | 696 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
697 p = ngx_cpymem(b->pos, ngx_http_msie_refresh_head, |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
698 sizeof(ngx_http_msie_refresh_head) - 1); |
679 | 699 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
700 if (escape == 0) { |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
701 p = ngx_cpymem(p, location, len); |
679 | 702 |
703 } else { | |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
704 p = (u_char *) ngx_escape_uri(p, location, len, NGX_ESCAPE_REFRESH); |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
705 } |
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
706 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
707 b->last = ngx_cpymem(p, ngx_http_msie_refresh_tail, |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
708 sizeof(ngx_http_msie_refresh_tail) - 1); |
509 | 709 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
710 b->last_buf = 1; |
509 | 711 b->last_in_chain = 1; |
103
6dfda4cf5200
nginx-0.0.1-2003-06-11-19:28:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
712 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
713 out.buf = b; |
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
714 out.next = NULL; |
501 | 715 |
1604
e27930ae2b8f
divide special response handling into several functions
Igor Sysoev <igor@sysoev.ru>
parents:
1592
diff
changeset
|
716 return ngx_http_output_filter(r, &out); |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
717 } |