comparison src/http/ngx_http_special_response.c @ 47:d81326c3b21b

nginx-0.0.1-2003-01-15-10:02:27 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 15 Jan 2003 07:02:27 +0000
parents f1ee46c036a4
children e8cdc2989cee
comparison
equal deleted inserted replaced
46:f84a648211f4 47:d81326c3b21b
31 "<head><title>404 Not Found</title></head>" CRLF 31 "<head><title>404 Not Found</title></head>" CRLF
32 "<body bgcolor=\"white\">" CRLF 32 "<body bgcolor=\"white\">" CRLF
33 "<center><h1>404 Not Found</h1></center>" CRLF 33 "<center><h1>404 Not Found</h1></center>" CRLF
34 ; 34 ;
35 35
36 static char error_500_page[] =
37 "<html>" CRLF
38 "<head><title>500 Internal Server Error</title></head>" CRLF
39 "<body bgcolor=\"white\">" CRLF
40 "<center><h1>500 Internal Server Error</h1></center>" CRLF
41 ;
42
36 43
37 static ngx_str_t error_pages[] = { 44 static ngx_str_t error_pages[] = {
38 { 0, NULL}, /* 301 */ 45 { 0, NULL}, /* 301 */
39 { 0, NULL}, /* 302 */ 46 { 0, NULL}, /* 302 */
40 { 0, NULL}, /* 303 */ 47 { 0, NULL}, /* 303 */
44 { 0, NULL}, /* 401 */ 51 { 0, NULL}, /* 401 */
45 { 0, NULL}, /* 402 */ 52 { 0, NULL}, /* 402 */
46 { sizeof(error_403_page) - 1, error_403_page }, 53 { sizeof(error_403_page) - 1, error_403_page },
47 { sizeof(error_404_page) - 1, error_404_page }, 54 { sizeof(error_404_page) - 1, error_404_page },
48 55
49 { 0, NULL} /* 500 */ 56 { sizeof(error_500_page) - 1, error_500_page }
50 }; 57 };
51 58
52 int ngx_http_special_response(ngx_http_request_t *r, int error) 59 int ngx_http_special_response(ngx_http_request_t *r, int error)
53 { 60 {
54 int rc, err, len; 61 int rc, err, len;
63 70
64 else if (error < NGX_HTTP_INTERNAL_SERVER_ERROR) 71 else if (error < NGX_HTTP_INTERNAL_SERVER_ERROR)
65 err = error - NGX_HTTP_BAD_REQUEST + 4; 72 err = error - NGX_HTTP_BAD_REQUEST + 4;
66 73
67 else 74 else
68 err = NGX_HTTP_INTERNAL_SERVER_ERROR + 4 + 5; 75 err = error - NGX_HTTP_INTERNAL_SERVER_ERROR + 4 + 5;
69 76
70 if (error_pages[err].len == 0) 77 if (error_pages[err].len == 0)
71 r->headers_out.content_length = -1; 78 r->headers_out.content_length = -1;
72 else 79 else
73 r->headers_out.content_length = error_pages[err].len 80 r->headers_out.content_length = error_pages[err].len