comparison src/http/ngx_http_request.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 e366ba5db8f8
comparison
equal deleted inserted replaced
342:0ee0642af5f1 343:6bdf858bff8c
234 if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { 234 if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
235 c->log->log_level = clcf->err_log->log_level; 235 c->log->log_level = clcf->err_log->log_level;
236 } 236 }
237 237
238 if (c->buffer == NULL) { 238 if (c->buffer == NULL) {
239 c->buffer = ngx_create_temp_hunk(c->pool, 239 c->buffer = ngx_create_temp_buf(c->pool,
240 cscf->client_header_buffer_size); 240 cscf->client_header_buffer_size);
241 if (c->buffer == NULL) { 241 if (c->buffer == NULL) {
242 ngx_http_close_connection(c); 242 ngx_http_close_connection(c);
243 return; 243 return;
244 } 244 }
245 } 245 }
1231 1231
1232 1232
1233 static void ngx_http_set_keepalive(ngx_http_request_t *r) 1233 static void ngx_http_set_keepalive(ngx_http_request_t *r)
1234 { 1234 {
1235 int len; 1235 int len;
1236 ngx_hunk_t *h; 1236 ngx_buf_t *b;
1237 ngx_event_t *rev, *wev; 1237 ngx_event_t *rev, *wev;
1238 ngx_connection_t *c; 1238 ngx_connection_t *c;
1239 ngx_http_log_ctx_t *ctx; 1239 ngx_http_log_ctx_t *ctx;
1240 ngx_http_core_srv_conf_t *cscf; 1240 ngx_http_core_srv_conf_t *cscf;
1241 ngx_http_core_loc_conf_t *clcf; 1241 ngx_http_core_loc_conf_t *clcf;
1255 if (ngx_handle_level_read_event(rev) == NGX_ERROR) { 1255 if (ngx_handle_level_read_event(rev) == NGX_ERROR) {
1256 ngx_http_close_connection(c); 1256 ngx_http_close_connection(c);
1257 return; 1257 return;
1258 } 1258 }
1259 1259
1260 h = c->buffer; 1260 b = c->buffer;
1261 wev = c->write; 1261 wev = c->write;
1262 wev->event_handler = ngx_http_empty_handler; 1262 wev->event_handler = ngx_http_empty_handler;
1263 1263
1264 1264
1265 if (h->pos < h->last) { 1265 if (b->pos < b->last) {
1266 1266
1267 /* 1267 /*
1268 * The pipelined request. 1268 * The pipelined request.
1269 * 1269 *
1270 * We do not know here whether the pipelined request is complete 1270 * We do not know here whether the pipelined request is complete
1275 */ 1275 */
1276 1276
1277 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); 1277 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
1278 1278
1279 if (!cscf->large_client_header) { 1279 if (!cscf->large_client_header) {
1280 len = h->last - h->pos; 1280 len = b->last - b->pos;
1281 ngx_memcpy(h->start, h->pos, len); 1281 ngx_memcpy(b->start, b->pos, len);
1282 h->pos = h->start; 1282 b->pos = b->start;
1283 h->last = h->start + len; 1283 b->last = b->start + len;
1284 } 1284 }
1285 1285
1286 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "pipelined request"); 1286 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "pipelined request");
1287 1287
1288 c->pipeline = 1; 1288 c->pipeline = 1;
1291 return; 1291 return;
1292 } 1292 }
1293 1293
1294 c->pipeline = 0; 1294 c->pipeline = 0;
1295 1295
1296 h->pos = h->last = h->start; 1296 b->pos = b->last = b->start;
1297 rev->event_handler = ngx_http_keepalive_handler; 1297 rev->event_handler = ngx_http_keepalive_handler;
1298 1298
1299 if (wev->active) { 1299 if (wev->active) {
1300 if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) { 1300 if (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT) {
1301 if (ngx_del_event(wev, NGX_WRITE_EVENT, NGX_DISABLE_EVENT) 1301 if (ngx_del_event(wev, NGX_WRITE_EVENT, NGX_DISABLE_EVENT)
1521 } 1521 }
1522 1522
1523 1523
1524 int ngx_http_send_last(ngx_http_request_t *r) 1524 int ngx_http_send_last(ngx_http_request_t *r)
1525 { 1525 {
1526 ngx_hunk_t *h; 1526 ngx_buf_t *b;
1527 ngx_chain_t out; 1527 ngx_chain_t out;
1528 1528
1529 ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR); 1529 if (!(b = ngx_calloc_buf(r->pool))) {
1530 h->type = NGX_HUNK_LAST; 1530 return NGX_ERROR;
1531 out.hunk = h; 1531 }
1532
1533 b->last_buf = 1;
1534 out.buf = b;
1532 out.next = NULL; 1535 out.next = NULL;
1533 1536
1534 return ngx_http_output_filter(r, &out); 1537 return ngx_http_output_filter(r, &out);
1535 } 1538 }
1536 1539