summaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
Diffstat (limited to 'src/http')
-rw-r--r--src/http/ngx_http_request.c23
-rw-r--r--src/http/ngx_http_request_body.c57
-rw-r--r--src/http/ngx_http_spdy.c4
-rw-r--r--src/http/ngx_http_upstream.c6
4 files changed, 42 insertions, 48 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index c8c5d153f..1be2d463f 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -423,20 +423,6 @@ ngx_http_wait_request_handler(ngx_event_t *rev)
if (n == NGX_AGAIN) {
-#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
- if (c->listening->deferred_accept
-#if (NGX_HTTP_SSL)
- && c->ssl == NULL
-#endif
- )
- {
- ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
- "client timed out in deferred accept");
- ngx_http_close_connection(c);
- return;
- }
-#endif
-
if (!rev->timer_set) {
ngx_add_timer(rev, c->listening->post_accept_timeout);
ngx_reusable_connection(c, 1);
@@ -635,15 +621,6 @@ ngx_http_ssl_handshake(ngx_event_t *rev)
if (n == -1) {
if (err == NGX_EAGAIN) {
-#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
- if (c->listening->deferred_accept) {
- ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
- "client timed out in deferred accept");
- ngx_http_close_connection(c);
- return;
- }
-#endif
-
if (!rev->timer_set) {
ngx_add_timer(rev, c->listening->post_accept_timeout);
ngx_reusable_connection(c, 1);
diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c
index 2c612311d..1d8bc4a28 100644
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -150,20 +150,27 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
goto done;
}
- cl = ngx_chain_get_free_buf(r->pool, &rb->free);
- if (cl == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
+ if (rb->temp_file->file.offset != 0) {
- b = cl->buf;
+ cl = ngx_chain_get_free_buf(r->pool, &rb->free);
+ if (cl == NULL) {
+ rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
+ goto done;
+ }
- ngx_memzero(b, sizeof(ngx_buf_t));
+ b = cl->buf;
- b->in_file = 1;
- b->file_last = rb->temp_file->file.offset;
- b->file = &rb->temp_file->file;
+ ngx_memzero(b, sizeof(ngx_buf_t));
- rb->bufs = cl;
+ b->in_file = 1;
+ b->file_last = rb->temp_file->file.offset;
+ b->file = &rb->temp_file->file;
+
+ rb->bufs = cl;
+
+ } else {
+ rb->bufs = NULL;
+ }
}
post_handler(r);
@@ -374,20 +381,26 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- cl = ngx_chain_get_free_buf(r->pool, &rb->free);
- if (cl == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
+ if (rb->temp_file->file.offset != 0) {
+
+ cl = ngx_chain_get_free_buf(r->pool, &rb->free);
+ if (cl == NULL) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
- b = cl->buf;
+ b = cl->buf;
- ngx_memzero(b, sizeof(ngx_buf_t));
+ ngx_memzero(b, sizeof(ngx_buf_t));
+
+ b->in_file = 1;
+ b->file_last = rb->temp_file->file.offset;
+ b->file = &rb->temp_file->file;
- b->in_file = 1;
- b->file_last = rb->temp_file->file.offset;
- b->file = &rb->temp_file->file;
+ rb->bufs = cl;
- rb->bufs = cl;
+ } else {
+ rb->bufs = NULL;
+ }
}
r->read_event_handler = ngx_http_block_reading;
@@ -842,6 +855,10 @@ ngx_http_request_body_length_filter(ngx_http_request_t *r, ngx_chain_t *in)
for (cl = in; cl; cl = cl->next) {
+ if (rb->rest == 0) {
+ break;
+ }
+
tl = ngx_chain_get_free_buf(r->pool, &rb->free);
if (tl == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
diff --git a/src/http/ngx_http_spdy.c b/src/http/ngx_http_spdy.c
index 7c93dc49a..f4f610a82 100644
--- a/src/http/ngx_http_spdy.c
+++ b/src/http/ngx_http_spdy.c
@@ -2626,6 +2626,10 @@ ngx_http_spdy_close_stream(ngx_http_spdy_stream_t *stream, ngx_int_t rc)
}
}
+ if (sc->stream == stream) {
+ sc->stream = NULL;
+ }
+
sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx,
ngx_http_spdy_module);
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 45e2eb7b9..ffdffcf07 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2459,11 +2459,7 @@ ngx_http_upstream_upgrade(ngx_http_request_t *r, ngx_http_upstream_t *u)
ngx_http_upstream_process_upgraded(r, 1, 1);
}
- if (c->read->ready
- || r->header_in->pos != r->header_in->last)
- {
- ngx_http_upstream_process_upgraded(r, 0, 1);
- }
+ ngx_http_upstream_process_upgraded(r, 0, 1);
}