Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/event/ngx_event_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,21 @@ ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p)

if (p->upstream_eof || p->upstream_error || p->upstream_done) {

/* the first free buf is partially filled */

if (p->upstream_error
&& p->free_raw_bufs
&& p->free_raw_bufs->buf->pos != p->free_raw_bufs->buf->last)
{
/* STUB */ p->free_raw_bufs->buf->num = p->num++;

if (p->input_filter(p, p->free_raw_bufs->buf) == NGX_ERROR) {
return NGX_ABORT;
}

p->free_raw_bufs = p->free_raw_bufs->next;
}

/* pass the p->out and p->in chains to the output filter */

for (cl = p->busy; cl; cl = cl->next) {
Expand Down
13 changes: 13 additions & 0 deletions src/http/ngx_http_upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -4369,6 +4369,19 @@ ngx_http_upstream_process_upstream(ngx_http_request_t *r,
p->upstream_error = 1;
ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out");

/*
* flush data already read from the upstream, except for
* an unrequested 101 response, whose body is not part
* of the response
*/

if (u->headers_in.status_n != NGX_HTTP_SWITCHING_PROTOCOLS
&& ngx_event_pipe(p, 1) == NGX_ABORT)
{
ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}

} else {

if (rev->delayed) {
Expand Down
Loading