Frame brokered HTTP responses once
This commit is contained in:
@@ -1388,6 +1388,8 @@ FastCGIServer::request_write_fgci(Connection& connection, RequestID id,
|
||||
//switch_to_system_alloc();
|
||||
write_data_fcgi(connection.output_buffer, id, request.out, FCGI_STDOUT);
|
||||
write_data_fcgi(connection.output_buffer, id, request.err, FCGI_STDERR);
|
||||
request.out.clear();
|
||||
request.err.clear();
|
||||
|
||||
FCGI_EndRequestRecord complete;
|
||||
bzero(&complete, sizeof(complete));
|
||||
|
||||
@@ -855,7 +855,13 @@ static String custom_server_dispatcher_key = "";
|
||||
int forward_request_to_worker(FastCGIRequest& request, u32 timeout_seconds = 30)
|
||||
{
|
||||
String fcgi_socket = first(server_state.config["FCGI_SOCKET_PATH"], "/run/uce.sock");
|
||||
FcgiForwardResult fwd = fcgi_forward_request(fcgi_socket, request.params, request.in, timeout_seconds);
|
||||
StringMap forward_params = request.params;
|
||||
// The broker accepted raw HTTP, but this hop is FastCGI. Without the CGI
|
||||
// marker Request::set_status() emits an HTTP status line that the FastCGI
|
||||
// reply parser correctly treats as body; the broker would then wrap that
|
||||
// complete response in a second HTTP response.
|
||||
forward_params["GATEWAY_INTERFACE"] = "CGI/1.1";
|
||||
FcgiForwardResult fwd = fcgi_forward_request(fcgi_socket, forward_params, request.in, timeout_seconds);
|
||||
request.ob_start();
|
||||
if(!fwd.ok)
|
||||
{
|
||||
|
||||
@@ -830,6 +830,8 @@ int uce_wasm_apply_context(const char* buf, size_t len)
|
||||
if(applied.key("server_config"))
|
||||
apply_map(applied.key("server_config"), wasm_server.config);
|
||||
apply_map(applied.key("params"), wasm_request.params);
|
||||
wasm_request.response_code = wasm_request.params["GATEWAY_INTERFACE"] != "" ?
|
||||
"Status: 200 OK" : "HTTP/1.1 200 OK";
|
||||
apply_map(applied.key("get"), wasm_request.get);
|
||||
apply_map(applied.key("post"), wasm_request.post);
|
||||
apply_map(applied.key("cookies"), wasm_request.cookies);
|
||||
|
||||
Reference in New Issue
Block a user