summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_request.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-10-09 07:00:45 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-10-09 07:00:45 +0000
commit1342d9cc29de7b6509a44a49cd66d1038d1e6d26 (patch)
tree618ccc0244627bece991abd6a49b354b417e1a21 /src/http/ngx_http_request.c
parent3ae32483cd9315aef5066e2a06411e9ffb8a5560 (diff)
downloadnginx-1342d9cc29de7b6509a44a49cd66d1038d1e6d26.tar.gz
nginx-1342d9cc29de7b6509a44a49cd66d1038d1e6d26.tar.bz2
nginx-0.0.1-2003-10-09-11:00:45 import
Diffstat (limited to '')
-rw-r--r--src/http/ngx_http_request.c (renamed from src/http/ngx_http_event.c)39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/http/ngx_http_event.c b/src/http/ngx_http_request.c
index ea8120764..0f66b0d40 100644
--- a/src/http/ngx_http_event.c
+++ b/src/http/ngx_http_request.c
@@ -785,6 +785,10 @@ void ngx_http_finalize_request(ngx_http_request_t *r, int error)
int rc;
ngx_event_t *rev, *wev;
+ if (r->main) {
+ return;
+ }
+
rc = error;
if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
@@ -813,9 +817,25 @@ void ngx_http_finalize_request(ngx_http_request_t *r, int error)
return;
}
+#if 1
+ return;
+#endif
+
} else if (rc == NGX_ERROR) {
r->keepalive = 0;
r->lingering_close = 0;
+
+ } else {
+ if (ngx_http_send_last(r) == NGX_ERROR) {
+ ngx_http_close_request(r, 0);
+ ngx_http_close_connection(r->connection);
+ return;
+ }
+
+ if (rc == NGX_AGAIN) {
+ ngx_http_set_write_handler(r);
+ return;
+ }
}
rev = r->connection->read;
@@ -840,6 +860,8 @@ void ngx_http_finalize_request(ngx_http_request_t *r, int error)
ngx_http_close_request(r, 0);
ngx_http_close_connection(r->connection);
}
+
+ return;
}
@@ -887,6 +909,8 @@ void ngx_http_set_write_handler(ngx_http_request_t *r)
ngx_http_close_request(r, 0);
ngx_http_close_connection(r->connection);
}
+
+ return;
}
@@ -951,6 +975,8 @@ static void ngx_http_writer(ngx_event_t *wev)
ngx_http_close_request(r, 0);
ngx_http_close_connection(r->connection);
}
+
+ return;
}
@@ -1046,6 +1072,8 @@ static void ngx_http_read_discarded_body_event(ngx_event_t *rev)
ngx_http_close_request(r, rc);
ngx_http_close_connection(c);
}
+
+ return;
}
@@ -1385,6 +1413,17 @@ static void ngx_http_empty_handler(ngx_event_t *wev)
}
+int ngx_http_send_last(ngx_http_request_t *r)
+{
+ ngx_hunk_t *h;
+
+ ngx_test_null(h, ngx_calloc_hunk(r->pool), NGX_ERROR);
+ h->type = NGX_HUNK_LAST;
+
+ return ngx_http_output_filter(r, h);
+}
+
+
void ngx_http_close_request(ngx_http_request_t *r, int error)
{
ngx_http_log_ctx_t *ctx;