comparison src/http/ngx_http_special_response.c @ 356:2e3cbc1bbe3c

nginx-0.0.7-2004-06-16-19:32:11 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 16 Jun 2004 15:32:11 +0000
parents 6bdf858bff8c
children e7054aaedf68
comparison
equal deleted inserted replaced
355:0fb6c53fb135 356:2e3cbc1bbe3c
175 ngx_string(error_503_page), 175 ngx_string(error_503_page),
176 ngx_string(error_504_page) 176 ngx_string(error_504_page)
177 }; 177 };
178 178
179 179
180 int ngx_http_special_response_handler(ngx_http_request_t *r, int error) 180 ngx_int_t ngx_http_special_response_handler(ngx_http_request_t *r, int error)
181 { 181 {
182 ngx_int_t rc; 182 ngx_int_t rc;
183 ngx_uint_t err, i; 183 ngx_uint_t err, i, msie_padding;
184 ngx_buf_t *b; 184 ngx_buf_t *b;
185 ngx_chain_t *out, **ll, *cl; 185 ngx_chain_t *out, **ll, *cl;
186 ngx_http_err_page_t *err_page; 186 ngx_http_err_page_t *err_page;
187 ngx_http_core_loc_conf_t *clcf; 187 ngx_http_core_loc_conf_t *clcf;
188 188
246 error = NGX_HTTP_NOT_FOUND; 246 error = NGX_HTTP_NOT_FOUND;
247 break; 247 break;
248 } 248 }
249 } 249 }
250 250
251 msie_padding = 0;
252
251 if (error_pages[err].len) { 253 if (error_pages[err].len) {
252 r->headers_out.content_length_n = error_pages[err].len 254 r->headers_out.content_length_n = error_pages[err].len
253 + sizeof(error_tail) - 1; 255 + sizeof(error_tail) - 1;
254 256
255 if (clcf->msie_padding 257 if (clcf->msie_padding
258 && r->headers_in.msie
256 && r->http_version >= NGX_HTTP_VERSION_10 259 && r->http_version >= NGX_HTTP_VERSION_10
257 && error >= NGX_HTTP_BAD_REQUEST 260 && error >= NGX_HTTP_BAD_REQUEST
258 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE) 261 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE)
259 { 262 {
260 r->headers_out.content_length_n += sizeof(msie_stub) - 1; 263 r->headers_out.content_length_n += sizeof(msie_stub) - 1;
264 msie_padding = 1;
261 } 265 }
262 266
263 if (!(r->headers_out.content_type = 267 if (!(r->headers_out.content_type =
264 ngx_http_add_header(&r->headers_out, ngx_http_headers_out))) 268 ngx_http_add_header(&r->headers_out, ngx_http_headers_out)))
265 { 269 {
312 b->last = error_tail + sizeof(error_tail) - 1; 316 b->last = error_tail + sizeof(error_tail) - 1;
313 317
314 ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR); 318 ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR);
315 ngx_chain_add_link(out, ll, cl); 319 ngx_chain_add_link(out, ll, cl);
316 320
317 if (clcf->msie_padding 321 if (msie_padding) {
318 && r->http_version >= NGX_HTTP_VERSION_10
319 && error >= NGX_HTTP_BAD_REQUEST
320 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE)
321 {
322 if (!(b = ngx_calloc_buf(r->pool))) { 322 if (!(b = ngx_calloc_buf(r->pool))) {
323 return NGX_ERROR; 323 return NGX_ERROR;
324 } 324 }
325 b->memory = 1; 325 b->memory = 1;
326 b->pos = msie_stub; 326 b->pos = msie_stub;