Mercurial > hg > nginx-vendor-0-6
comparison src/http/ngx_http_special_response.c @ 222:dd6c66b5b0e2 NGINX_0_3_58
nginx 0.3.58
*) Feature: the "error_page" directive supports the variables.
*) Change: now the procfs interface instead of sysctl is used on Linux.
*) Change: now the "Content-Type" header line is inherited from first
response when the "X-Accel-Redirect" was used.
*) Bugfix: the "error_page" directive did not redirect the 413 error.
*) Bugfix: the trailing "?" did not remove old arguments if no new
arguments were added to a rewritten URI.
*) Bugfix: nginx could not run on 64-bit FreeBSD 7.0-CURRENT.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 14 Aug 2006 00:00:00 +0400 |
parents | 8759b346e431 |
children | 9909a161eb28 |
comparison
equal
deleted
inserted
replaced
221:52ac9a089ea5 | 222:dd6c66b5b0e2 |
---|---|
293 | 293 |
294 ngx_int_t | 294 ngx_int_t |
295 ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error) | 295 ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error) |
296 { | 296 { |
297 ngx_int_t rc; | 297 ngx_int_t rc; |
298 ngx_buf_t *b; | |
299 ngx_str_t *uri; | |
298 ngx_uint_t i, err, msie_padding; | 300 ngx_uint_t i, err, msie_padding; |
299 ngx_buf_t *b; | |
300 ngx_chain_t *out, *cl; | 301 ngx_chain_t *out, *cl; |
301 ngx_http_err_page_t *err_page; | 302 ngx_http_err_page_t *err_page; |
302 ngx_http_core_loc_conf_t *clcf; | 303 ngx_http_core_loc_conf_t *clcf; |
303 | 304 |
304 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 305 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
347 r->err_status = err_page[i].overwrite; | 348 r->err_status = err_page[i].overwrite; |
348 r->err_ctx = r->ctx; | 349 r->err_ctx = r->ctx; |
349 | 350 |
350 r->method = NGX_HTTP_GET; | 351 r->method = NGX_HTTP_GET; |
351 | 352 |
352 if (err_page[i].uri.data[0] == '/') { | 353 uri = &err_page[i].uri; |
353 return ngx_http_internal_redirect(r, &err_page[i].uri, | 354 |
354 NULL); | 355 if (err_page[i].uri_lengths) { |
356 if (ngx_http_script_run(r, uri, | |
357 err_page[i].uri_lengths->elts, 0, | |
358 err_page[i].uri_values->elts) | |
359 == NULL) | |
360 { | |
361 return NGX_ERROR; | |
362 } | |
363 } | |
364 | |
365 if (uri->data[0] == '/') { | |
366 return ngx_http_internal_redirect(r, uri, NULL); | |
355 } | 367 } |
356 | 368 |
357 r->headers_out.location = | 369 r->headers_out.location = |
358 ngx_list_push(&r->headers_out.headers); | 370 ngx_list_push(&r->headers_out.headers); |
359 | 371 |
362 error = NGX_HTTP_MOVED_TEMPORARILY; | 374 error = NGX_HTTP_MOVED_TEMPORARILY; |
363 | 375 |
364 r->headers_out.location->hash = 1; | 376 r->headers_out.location->hash = 1; |
365 r->headers_out.location->key.len = sizeof("Location") - 1; | 377 r->headers_out.location->key.len = sizeof("Location") - 1; |
366 r->headers_out.location->key.data = (u_char *) "Location"; | 378 r->headers_out.location->key.data = (u_char *) "Location"; |
367 r->headers_out.location->value = err_page[i].uri; | 379 r->headers_out.location->value = *uri; |
368 | 380 |
369 } else { | 381 } else { |
370 error = NGX_HTTP_INTERNAL_SERVER_ERROR; | 382 return NGX_ERROR; |
371 } | 383 } |
372 } | 384 } |
373 } | 385 } |
374 } | 386 } |
375 | 387 |