comparison src/http/ngx_http_special_response.c @ 155:46eb23d9471d

nginx-0.0.1-2003-10-22-20:38:26 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 22 Oct 2003 16:38:26 +0000
parents c71aeb75c071
children d377ee423603
comparison
equal deleted inserted replaced
154:eac26585476e 155:46eb23d9471d
152 152
153 int ngx_http_special_response_handler(ngx_http_request_t *r, int error) 153 int ngx_http_special_response_handler(ngx_http_request_t *r, int error)
154 { 154 {
155 int err, rc; 155 int err, rc;
156 ngx_hunk_t *h; 156 ngx_hunk_t *h;
157 ngx_chain_t *out, **le, *ce; 157 ngx_chain_t *out, **ll, *cl;
158 158
159 r->headers_out.status = error; 159 r->headers_out.status = error;
160 160
161 if (error < NGX_HTTP_BAD_REQUEST) { 161 if (error < NGX_HTTP_BAD_REQUEST) {
162 /* 3XX */ 162 /* 3XX */
217 if (error_pages[err].len == 0) { 217 if (error_pages[err].len == 0) {
218 return NGX_OK; 218 return NGX_OK;
219 } 219 }
220 220
221 out = NULL; 221 out = NULL;
222 le = NULL; 222 ll = NULL;
223 223
224 ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); 224 ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR);
225 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; 225 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY;
226 h->pos = error_pages[err].data; 226 h->pos = error_pages[err].data;
227 h->last = error_pages[err].data + error_pages[err].len; 227 h->last = error_pages[err].data + error_pages[err].len;
228 228
229 ngx_alloc_ce_and_set_hunk(ce, h, r->pool, NGX_ERROR); 229 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR);
230 ngx_chain_add_ce(out, le, ce); 230 ngx_chain_add_link(out, ll, cl);
231 231
232 232
233 ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); 233 ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR);
234 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; 234 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY;
235 h->pos = error_tail; 235 h->pos = error_tail;
236 h->last = error_tail + sizeof(error_tail) - 1; 236 h->last = error_tail + sizeof(error_tail) - 1;
237 237
238 ngx_alloc_ce_and_set_hunk(ce, h, r->pool, NGX_ERROR); 238 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR);
239 ngx_chain_add_ce(out, le, ce); 239 ngx_chain_add_link(out, ll, cl);
240 240
241 if (/* STUB: "msie_padding on/off" */ 1 241 if (/* STUB: "msie_padding on/off" */ 1
242 && r->http_version >= NGX_HTTP_VERSION_10 242 && r->http_version >= NGX_HTTP_VERSION_10
243 && error >= NGX_HTTP_BAD_REQUEST 243 && error >= NGX_HTTP_BAD_REQUEST
244 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE 244 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE
247 ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); 247 ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR);
248 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; 248 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY;
249 h->pos = msie_stub; 249 h->pos = msie_stub;
250 h->last = msie_stub + sizeof(msie_stub) - 1; 250 h->last = msie_stub + sizeof(msie_stub) - 1;
251 251
252 ngx_alloc_ce_and_set_hunk(ce, h, r->pool, NGX_ERROR); 252 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR);
253 ngx_chain_add_ce(out, le, ce); 253 ngx_chain_add_link(out, ll, cl);
254 } 254 }
255 255
256 h->type |= NGX_HUNK_LAST; 256 h->type |= NGX_HUNK_LAST;
257 257
258 return ngx_http_output_filter(r, out); 258 return ngx_http_output_filter(r, out);