comparison src/http/ngx_http_upstream.c @ 7232:a7ed15573ae9

Upstream: u->conf->preserve_output flag. The flag can be used to continue sending request body even after we've got a response from the backend. In particular, this is needed for gRPC proxying of bidirectional streaming RPCs, and also to send control frames in other forms of RPCs.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 17 Mar 2018 23:04:23 +0300
parents 22f7bdbd96d3
children 400a3412b1e3
comparison
equal deleted inserted replaced
7231:22f7bdbd96d3 7232:a7ed15573ae9
2029 } 2029 }
2030 2030
2031 c->tcp_nopush = NGX_TCP_NOPUSH_UNSET; 2031 c->tcp_nopush = NGX_TCP_NOPUSH_UNSET;
2032 } 2032 }
2033 2033
2034 u->write_event_handler = ngx_http_upstream_dummy_handler; 2034 if (!u->conf->preserve_output) {
2035 u->write_event_handler = ngx_http_upstream_dummy_handler;
2036 }
2035 2037
2036 if (ngx_handle_write_event(c->write, 0) != NGX_OK) { 2038 if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
2037 ngx_http_upstream_finalize_request(r, u, 2039 ngx_http_upstream_finalize_request(r, u,
2038 NGX_HTTP_INTERNAL_SERVER_ERROR); 2040 NGX_HTTP_INTERNAL_SERVER_ERROR);
2039 return; 2041 return;
2191 return; 2193 return;
2192 } 2194 }
2193 2195
2194 #endif 2196 #endif
2195 2197
2196 if (u->header_sent) { 2198 if (u->header_sent && !u->conf->preserve_output) {
2197 u->write_event_handler = ngx_http_upstream_dummy_handler; 2199 u->write_event_handler = ngx_http_upstream_dummy_handler;
2198 2200
2199 (void) ngx_handle_write_event(c->write, 0); 2201 (void) ngx_handle_write_event(c->write, 0);
2200 2202
2201 return; 2203 return;