Mercurial > hg > nginx
comparison src/http/ngx_http_special_response.c @ 164:84036764e215
nginx-0.0.1-2003-10-29-11:30:44 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 29 Oct 2003 08:30:44 +0000 |
parents | 96993d4d5067 |
children | 894a01c6aea3 |
comparison
equal
deleted
inserted
replaced
163:fb61ba77beba | 164:84036764e215 |
---|---|
216 if (error_pages[err].len) { | 216 if (error_pages[err].len) { |
217 r->headers_out.content_length_n = error_pages[err].len | 217 r->headers_out.content_length_n = error_pages[err].len |
218 + sizeof(error_tail) - 1 | 218 + sizeof(error_tail) - 1 |
219 + sizeof(msie_stub) - 1; | 219 + sizeof(msie_stub) - 1; |
220 | 220 |
221 ngx_test_null(r->headers_out.content_type, | 221 if (!(r->headers_out.content_type = |
222 ngx_push_table(r->headers_out.headers), | 222 ngx_http_add_header(&r->headers_out, ngx_http_headers_out))) |
223 NGX_HTTP_INTERNAL_SERVER_ERROR); | 223 { |
224 return NGX_ERROR; | |
225 } | |
224 | 226 |
225 r->headers_out.content_type->key.len = 12; | 227 r->headers_out.content_type->key.len = 12; |
226 r->headers_out.content_type->key.data = "Content-Type"; | 228 r->headers_out.content_type->key.data = "Content-Type"; |
227 r->headers_out.content_type->value.len = 9; | 229 r->headers_out.content_type->value.len = 9; |
228 r->headers_out.content_type->value.data = "text/html"; | 230 r->headers_out.content_type->value.data = "text/html"; |
243 } | 245 } |
244 | 246 |
245 out = NULL; | 247 out = NULL; |
246 ll = NULL; | 248 ll = NULL; |
247 | 249 |
248 ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); | 250 if (!(h = ngx_calloc_hunk(r->pool))) { |
251 return NGX_ERROR; | |
252 } | |
249 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; | 253 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; |
250 h->pos = error_pages[err].data; | 254 h->pos = error_pages[err].data; |
251 h->last = error_pages[err].data + error_pages[err].len; | 255 h->last = error_pages[err].data + error_pages[err].len; |
252 | 256 |
253 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR); | 257 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR); |
254 ngx_chain_add_link(out, ll, cl); | 258 ngx_chain_add_link(out, ll, cl); |
255 | 259 |
256 | 260 |
257 ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); | 261 if (!(h = ngx_calloc_hunk(r->pool))) { |
262 return NGX_ERROR; | |
263 } | |
258 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; | 264 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; |
259 h->pos = error_tail; | 265 h->pos = error_tail; |
260 h->last = error_tail + sizeof(error_tail) - 1; | 266 h->last = error_tail + sizeof(error_tail) - 1; |
261 | 267 |
262 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR); | 268 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR); |
268 && r->http_version >= NGX_HTTP_VERSION_10 | 274 && r->http_version >= NGX_HTTP_VERSION_10 |
269 && error >= NGX_HTTP_BAD_REQUEST | 275 && error >= NGX_HTTP_BAD_REQUEST |
270 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE | 276 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE |
271 ) | 277 ) |
272 { | 278 { |
273 ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); | 279 if (!(h = ngx_calloc_hunk(r->pool))) { |
280 return NGX_ERROR; | |
281 } | |
274 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; | 282 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; |
275 h->pos = msie_stub; | 283 h->pos = msie_stub; |
276 h->last = msie_stub + sizeof(msie_stub) - 1; | 284 h->last = msie_stub + sizeof(msie_stub) - 1; |
277 | 285 |
278 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR); | 286 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR); |