comparison src/http/ngx_http_request.c @ 239:574bea0142be

nginx-0.0.1-2004-01-26-11:52:49 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 26 Jan 2004 08:52:49 +0000
parents 4eaafcd57be7
children 187dc0a3197d
comparison
equal deleted inserted replaced
238:674f85a4d00f 239:574bea0142be
1113 static int ngx_http_read_discarded_body(ngx_http_request_t *r) 1113 static int ngx_http_read_discarded_body(ngx_http_request_t *r)
1114 { 1114 {
1115 ssize_t size, n; 1115 ssize_t size, n;
1116 ngx_http_core_loc_conf_t *clcf; 1116 ngx_http_core_loc_conf_t *clcf;
1117 1117
1118 ngx_log_debug(r->connection->log, "http read discarded body"); 1118 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1119 "http read discarded body");
1119 1120
1120 if (r->headers_in.content_length_n == 0) { 1121 if (r->headers_in.content_length_n == 0) {
1121 return NGX_OK; 1122 return NGX_OK;
1122 } 1123 }
1123 1124
1162 ngx_http_core_loc_conf_t *clcf; 1163 ngx_http_core_loc_conf_t *clcf;
1163 1164
1164 c = r->connection; 1165 c = r->connection;
1165 rev = c->read; 1166 rev = c->read;
1166 1167
1167 ngx_log_debug(c->log, "set http keepalive handler"); 1168 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "set http keepalive handler");
1168 1169
1169 ctx = (ngx_http_log_ctx_t *) c->log->data; 1170 ctx = (ngx_http_log_ctx_t *) c->log->data;
1170 ctx->action = "closing request"; 1171 ctx->action = "closing request";
1171 ngx_http_close_request(r, 0); 1172 ngx_http_close_request(r, 0);
1172 1173
1199 ngx_memcpy(h->start, h->pos, len); 1200 ngx_memcpy(h->start, h->pos, len);
1200 h->pos = h->start; 1201 h->pos = h->start;
1201 h->last = h->start + len; 1202 h->last = h->start + len;
1202 } 1203 }
1203 1204
1204 ngx_log_debug(c->log, "pipelined request"); 1205 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "pipelined request");
1205 1206
1206 c->pipeline = 1; 1207 c->pipeline = 1;
1207 ctx->action = "reading client pipelined request line"; 1208 ctx->action = "reading client pipelined request line";
1208 ngx_http_init_request(rev); 1209 ngx_http_init_request(rev);
1209 return; 1210 return;
1257 ngx_connection_t *c; 1258 ngx_connection_t *c;
1258 ngx_http_log_ctx_t *ctx; 1259 ngx_http_log_ctx_t *ctx;
1259 1260
1260 c = (ngx_connection_t *) rev->data; 1261 c = (ngx_connection_t *) rev->data;
1261 1262
1262 ngx_log_debug(c->log, "http keepalive handler"); 1263 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http keepalive handler");
1263 1264
1264 if (rev->timedout) { 1265 if (rev->timedout) {
1265 ngx_http_close_connection(c); 1266 ngx_http_close_connection(c);
1266 return; 1267 return;
1267 } 1268 }
1368 ngx_http_core_loc_conf_t *clcf; 1369 ngx_http_core_loc_conf_t *clcf;
1369 1370
1370 c = rev->data; 1371 c = rev->data;
1371 r = c->data; 1372 r = c->data;
1372 1373
1373 ngx_log_debug(c->log, "http lingering close handler"); 1374 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
1375 "http lingering close handler");
1374 1376
1375 if (rev->timedout) { 1377 if (rev->timedout) {
1376 ngx_http_close_request(r, 0); 1378 ngx_http_close_request(r, 0);
1377 ngx_http_close_connection(c); 1379 ngx_http_close_connection(c);
1378 return; 1380 return;
1409 } 1411 }
1410 1412
1411 do { 1413 do {
1412 n = ngx_recv(c, r->discarded_buffer, clcf->discarded_buffer_size); 1414 n = ngx_recv(c, r->discarded_buffer, clcf->discarded_buffer_size);
1413 1415
1414 ngx_log_debug(c->log, "lingering read: %d" _ n); 1416 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "lingering read: %d", n);
1415 1417
1416 if (n == NGX_ERROR || n == 0) { 1418 if (n == NGX_ERROR || n == 0) {
1417 ngx_http_close_request(r, 0); 1419 ngx_http_close_request(r, 0);
1418 ngx_http_close_connection(c); 1420 ngx_http_close_connection(c);
1419 return; 1421 return;
1432 } 1434 }
1433 1435
1434 1436
1435 void ngx_http_empty_handler(ngx_event_t *wev) 1437 void ngx_http_empty_handler(ngx_event_t *wev)
1436 { 1438 {
1437 ngx_log_debug(wev->log, "http EMPTY handler"); 1439 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0, "http empty handler");
1438 1440
1439 return; 1441 return;
1440 } 1442 }
1441 1443
1442 1444
1517 } 1519 }
1518 1520
1519 1521
1520 void ngx_http_close_connection(ngx_connection_t *c) 1522 void ngx_http_close_connection(ngx_connection_t *c)
1521 { 1523 {
1522 ngx_log_debug(c->log, "close connection: %d" _ c->fd); 1524 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
1525 "close connection: %d", c->fd);
1523 1526
1524 if (c->pool == NULL) { 1527 if (c->pool == NULL) {
1525 ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed"); 1528 ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed");
1526 return; 1529 return;
1527 } 1530 }