diff --git a/core/logging.c b/core/logging.c index d2103d22..b00d94eb 100644 --- a/core/logging.c +++ b/core/logging.c @@ -610,8 +610,6 @@ void uwsgi_logit_simple(struct wsgi_request *wsgi_req) { via = msg3; break; case UWSGI_VIA_OFFLOAD: - // set the status to 202 as it is unavailable - wsgi_req->status = 202; via = msg4; break; default: diff --git a/plugins/router_http/router_http.c b/plugins/router_http/router_http.c index 8947e680..3acbd41c 100644 --- a/plugins/router_http/router_http.c +++ b/plugins/router_http/router_http.c @@ -55,6 +55,7 @@ static int uwsgi_routing_func_http(struct wsgi_request *wsgi_req, struct uwsgi_r } if (!uwsgi_offload_request_net_do(wsgi_req, addr, ub)) { wsgi_req->via = UWSGI_VIA_OFFLOAD; + wsgi_req->status = 202; return UWSGI_ROUTE_BREAK; } } diff --git a/plugins/router_uwsgi/router_uwsgi.c b/plugins/router_uwsgi/router_uwsgi.c index 597726a0..b8b87e7a 100644 --- a/plugins/router_uwsgi/router_uwsgi.c +++ b/plugins/router_uwsgi/router_uwsgi.c @@ -58,9 +58,16 @@ static int uwsgi_routing_func_uwsgi_remote(struct wsgi_request *wsgi_req, struct } // ok now if have offload threads, directly use them - if (wsgi_req->socket->can_offload) { + if (!wsgi_req->post_file && wsgi_req->socket->can_offload) { + // append buffered body + if (uwsgi.post_buffering > 0 && wsgi_req->post_cl > 0) { + if (uwsgi_buffer_append(ub, wsgi_req->post_buffering_buf, wsgi_req->post_cl)) { + goto end; + } + } if (!uwsgi_offload_request_net_do(wsgi_req, addr, ub)) { wsgi_req->via = UWSGI_VIA_OFFLOAD; + wsgi_req->status = 202; return UWSGI_ROUTE_BREAK; } }