comparison src/http/ngx_http_special_response.c @ 343:6bdf858bff8c

nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
author Igor Sysoev <igor@sysoev.ru>
date Fri, 28 May 2004 15:49:23 +0000
parents d4241d7787fe
children 2e3cbc1bbe3c
comparison
equal deleted inserted replaced
342:0ee0642af5f1 343:6bdf858bff8c
179 179
180 int ngx_http_special_response_handler(ngx_http_request_t *r, int error) 180 int ngx_http_special_response_handler(ngx_http_request_t *r, int error)
181 { 181 {
182 ngx_int_t rc; 182 ngx_int_t rc;
183 ngx_uint_t err, i; 183 ngx_uint_t err, i;
184 ngx_hunk_t *h; 184 ngx_buf_t *b;
185 ngx_chain_t *out, **ll, *cl; 185 ngx_chain_t *out, **ll, *cl;
186 ngx_http_err_page_t *err_page; 186 ngx_http_err_page_t *err_page;
187 ngx_http_core_loc_conf_t *clcf; 187 ngx_http_core_loc_conf_t *clcf;
188 188
189 rc = ngx_http_discard_body(r); 189 rc = ngx_http_discard_body(r);
291 } 291 }
292 292
293 out = NULL; 293 out = NULL;
294 ll = NULL; 294 ll = NULL;
295 295
296 if (!(h = ngx_calloc_hunk(r->pool))) { 296 if (!(b = ngx_calloc_buf(r->pool))) {
297 return NGX_ERROR; 297 return NGX_ERROR;
298 } 298 }
299 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; 299 b->memory = 1;
300 h->pos = error_pages[err].data; 300 b->pos = error_pages[err].data;
301 h->last = error_pages[err].data + error_pages[err].len; 301 b->last = error_pages[err].data + error_pages[err].len;
302 302
303 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR); 303 ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR);
304 ngx_chain_add_link(out, ll, cl); 304 ngx_chain_add_link(out, ll, cl);
305 305
306 306
307 if (!(h = ngx_calloc_hunk(r->pool))) { 307 if (!(b = ngx_calloc_buf(r->pool))) {
308 return NGX_ERROR; 308 return NGX_ERROR;
309 } 309 }
310 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; 310 b->memory = 1;
311 h->pos = error_tail; 311 b->pos = error_tail;
312 h->last = error_tail + sizeof(error_tail) - 1; 312 b->last = error_tail + sizeof(error_tail) - 1;
313 313
314 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR); 314 ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR);
315 ngx_chain_add_link(out, ll, cl); 315 ngx_chain_add_link(out, ll, cl);
316 316
317 if (clcf->msie_padding 317 if (clcf->msie_padding
318 && r->http_version >= NGX_HTTP_VERSION_10 318 && r->http_version >= NGX_HTTP_VERSION_10
319 && error >= NGX_HTTP_BAD_REQUEST 319 && error >= NGX_HTTP_BAD_REQUEST
320 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE) 320 && error != NGX_HTTP_REQUEST_URI_TOO_LARGE)
321 { 321 {
322 if (!(h = ngx_calloc_hunk(r->pool))) { 322 if (!(b = ngx_calloc_buf(r->pool))) {
323 return NGX_ERROR; 323 return NGX_ERROR;
324 } 324 }
325 h->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; 325 b->memory = 1;
326 h->pos = msie_stub; 326 b->pos = msie_stub;
327 h->last = msie_stub + sizeof(msie_stub) - 1; 327 b->last = msie_stub + sizeof(msie_stub) - 1;
328 328
329 ngx_alloc_link_and_set_hunk(cl, h, r->pool, NGX_ERROR); 329 ngx_alloc_link_and_set_buf(cl, b, r->pool, NGX_ERROR);
330 ngx_chain_add_link(out, ll, cl); 330 ngx_chain_add_link(out, ll, cl);
331 } 331 }
332 332
333 h->type |= NGX_HUNK_LAST; 333 b->last_buf = 1;
334 334
335 return ngx_http_output_filter(r, out); 335 return ngx_http_output_filter(r, out);
336 } 336 }