Mercurial > hg > nginx-vendor-0-8
comparison src/http/ngx_http_special_response.c @ 50:72eb30262aac NGINX_0_1_25
nginx 0.1.25
*) Bugfix: nginx did run on Linux parisc.
*) Feature: nginx now does not start under FreeBSD if the sysctl
kern.ipc.somaxconn value is too big.
*) Bugfix: if a request was internally redirected by the
ngx_http_index_module module to the ngx_http_proxy_module or
ngx_http_fastcgi_module modules, then the index file was not closed
after request completion.
*) Feature: the "proxy_pass" can be used in location with regular
expression.
*) Feature: the ngx_http_rewrite_filter_module module supports the
condition like "if ($HTTP_USER_AGENT ~ MSIE)".
*) Bugfix: nginx started too slow if the large number of addresses and
text values were used in the "geo" directive.
*) Change: a variable name must be declared as "$name" in the "geo"
directive. The previous variant without "$" is still supported, but
will be removed soon.
*) Feature: the "%{VARIABLE}v" logging parameter.
*) Feature: the "set $name value" directive.
*) Bugfix: gcc 4.0 compatibility.
*) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Sat, 19 Mar 2005 00:00:00 +0300 |
parents | 6cfc63e68377 |
children | 0d75d65c642f |
comparison
equal
deleted
inserted
replaced
49:93dabbc9efb9 | 50:72eb30262aac |
---|---|
15 "</body>" CRLF | 15 "</body>" CRLF |
16 "</html>" CRLF | 16 "</html>" CRLF |
17 ; | 17 ; |
18 | 18 |
19 | 19 |
20 static u_char msie_stub[] = | 20 static u_char ngx_http_msie_stub[] = |
21 "<!-- The padding to disable MSIE's friendly error page -->" CRLF | 21 "<!-- The padding to disable MSIE's friendly error page -->" CRLF |
22 "<!-- The padding to disable MSIE's friendly error page -->" CRLF | 22 "<!-- The padding to disable MSIE's friendly error page -->" CRLF |
23 "<!-- The padding to disable MSIE's friendly error page -->" CRLF | 23 "<!-- The padding to disable MSIE's friendly error page -->" CRLF |
24 "<!-- The padding to disable MSIE's friendly error page -->" CRLF | 24 "<!-- The padding to disable MSIE's friendly error page -->" CRLF |
25 "<!-- The padding to disable MSIE's friendly error page -->" CRLF | 25 "<!-- The padding to disable MSIE's friendly error page -->" CRLF |
232 | 232 |
233 ngx_int_t | 233 ngx_int_t |
234 ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error) | 234 ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error) |
235 { | 235 { |
236 ngx_int_t rc; | 236 ngx_int_t rc; |
237 ngx_uint_t err, i, msie_padding; | 237 ngx_uint_t i, err, msie_padding; |
238 ngx_buf_t *b; | 238 ngx_buf_t *b; |
239 ngx_chain_t *out, **ll, *cl; | 239 ngx_chain_t *out, *cl; |
240 ngx_http_err_page_t *err_page; | 240 ngx_http_err_page_t *err_page; |
241 ngx_http_core_loc_conf_t *clcf; | 241 ngx_http_core_loc_conf_t *clcf; |
242 | 242 |
243 rc = ngx_http_discard_body(r); | 243 rc = ngx_http_discard_body(r); |
244 | 244 |
325 && r->headers_in.msie | 325 && r->headers_in.msie |
326 && r->http_version >= NGX_HTTP_VERSION_10 | 326 && r->http_version >= NGX_HTTP_VERSION_10 |
327 && error >= NGX_HTTP_BAD_REQUEST | 327 && error >= NGX_HTTP_BAD_REQUEST |
328 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE) | 328 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE) |
329 { | 329 { |
330 r->headers_out.content_length_n += sizeof(msie_stub) - 1; | 330 r->headers_out.content_length_n += sizeof(ngx_http_msie_stub) - 1; |
331 msie_padding = 1; | 331 msie_padding = 1; |
332 } | 332 } |
333 | 333 |
334 r->headers_out.content_type = ngx_list_push(&r->headers_out.headers); | 334 r->headers_out.content_type = ngx_list_push(&r->headers_out.headers); |
335 if (r->headers_out.content_type == NULL) { | 335 if (r->headers_out.content_type == NULL) { |
358 | 358 |
359 if (error_pages[err].len == 0) { | 359 if (error_pages[err].len == 0) { |
360 return NGX_OK; | 360 return NGX_OK; |
361 } | 361 } |
362 | 362 |
363 out = NULL; | 363 |
364 ll = NULL; | 364 b = ngx_calloc_buf(r->pool); |
365 | 365 if (b == NULL) { |
366 if (!(b = ngx_calloc_buf(r->pool))) { | |
367 return NGX_ERROR; | 366 return NGX_ERROR; |
368 } | 367 } |
368 | |
369 b->memory = 1; | 369 b->memory = 1; |
370 b->pos = error_pages[err].data; | 370 b->pos = error_pages[err].data; |
371 b->last = error_pages[err].data + error_pages[err].len; | 371 b->last = error_pages[err].data + error_pages[err].len; |
372 | 372 |
373 ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR); | 373 cl = ngx_alloc_chain_link(r->pool); |
374 ngx_chain_add_link(out, ll, cl); | 374 if (cl == NULL) { |
375 | |
376 | |
377 if (!(b = ngx_calloc_buf(r->pool))) { | |
378 return NGX_ERROR; | 375 return NGX_ERROR; |
379 } | 376 } |
377 | |
378 cl->buf = b; | |
379 out = cl; | |
380 | |
381 | |
382 b = ngx_calloc_buf(r->pool); | |
383 if (b == NULL) { | |
384 return NGX_ERROR; | |
385 } | |
386 | |
380 b->memory = 1; | 387 b->memory = 1; |
381 b->pos = error_tail; | 388 b->pos = error_tail; |
382 b->last = error_tail + sizeof(error_tail) - 1; | 389 b->last = error_tail + sizeof(error_tail) - 1; |
383 | 390 |
384 ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR); | 391 cl->next = ngx_alloc_chain_link(r->pool); |
385 ngx_chain_add_link(out, ll, cl); | 392 if (cl->next == NULL) { |
393 return NGX_ERROR; | |
394 } | |
395 | |
396 cl = cl->next; | |
397 cl->buf = b; | |
386 | 398 |
387 if (msie_padding) { | 399 if (msie_padding) { |
388 if (!(b = ngx_calloc_buf(r->pool))) { | 400 b = ngx_calloc_buf(r->pool); |
401 if (b == NULL) { | |
389 return NGX_ERROR; | 402 return NGX_ERROR; |
390 } | 403 } |
404 | |
391 b->memory = 1; | 405 b->memory = 1; |
392 b->pos = msie_stub; | 406 b->pos = ngx_http_msie_stub; |
393 b->last = msie_stub + sizeof(msie_stub) - 1; | 407 b->last = ngx_http_msie_stub + sizeof(ngx_http_msie_stub) - 1; |
394 | 408 |
395 ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR); | 409 cl->next = ngx_alloc_chain_link(r->pool); |
396 ngx_chain_add_link(out, ll, cl); | 410 if (cl->next == NULL) { |
411 return NGX_ERROR; | |
412 } | |
413 | |
414 cl = cl->next; | |
415 cl->buf = b; | |
397 } | 416 } |
398 | 417 |
399 b->last_buf = 1; | 418 b->last_buf = 1; |
419 | |
420 cl->next = NULL; | |
400 | 421 |
401 return ngx_http_output_filter(r, out); | 422 return ngx_http_output_filter(r, out); |
402 } | 423 } |