Skip to content

Commit

Permalink
Merge pull request alibaba#594 from ym/master
Browse files Browse the repository at this point in the history
Backport bug fix for SPDY from nginx
  • Loading branch information
chobits committed Apr 21, 2015
2 parents 7202f13 + f3070ea commit cc38c98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
14 changes: 4 additions & 10 deletions src/event/ngx_event_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,10 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p)
}
}

if (p->cacheable && p->in) {
if (p->cacheable && (p->in || p->buf_to_file)) {
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
"pipe write chain");

if (ngx_event_pipe_write_chain_to_temp_file(p) == NGX_ABORT) {
return NGX_ABORT;
}
Expand Down Expand Up @@ -515,15 +518,6 @@ ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p)
p->in = NULL;
}

if (p->cacheable && p->buf_to_file) {
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
"pipe write chain");

if (ngx_event_pipe_write_chain_to_temp_file(p) == NGX_ABORT) {
return NGX_ABORT;
}
}

ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
"pipe write downstream done");

Expand Down
18 changes: 7 additions & 11 deletions src/http/ngx_http_upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -2661,21 +2661,17 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)

if (r->header_only) {

if (u->cacheable || u->store) {

if (ngx_shutdown_socket(c->fd, NGX_WRITE_SHUTDOWN) == -1) {
ngx_connection_error(c, ngx_socket_errno,
ngx_shutdown_socket_n " failed");
}

r->read_event_handler = ngx_http_request_empty_handler;
r->write_event_handler = ngx_http_request_empty_handler;
c->error = 1;
if (!u->buffering) {
ngx_http_upstream_finalize_request(r, u, rc);
return;
}

} else {
if (!u->cacheable && !u->store) {
ngx_http_upstream_finalize_request(r, u, rc);
return;
}

u->pipe->downstream_error = 1;
}

if (r->request_body && r->request_body->temp_file) {
Expand Down

0 comments on commit cc38c98

Please sign in to comment.