[core] disable streaming response with authorizer (fixes #3106)

disable streaming response while processing "authorizer" mode
until "authorizer" response 200 OK from the backend is complete

(thx jefftharris)

x-ref:
  "FastCGI authorizer hang with server.stream-response-body"
  https://redmine.lighttpd.net/boards/2/topics/9969
  "FastCGI authorizer hang with server.stream-response-body"
  https://redmine.lighttpd.net/issues/3106
master
Glenn Strauss 2 years ago
parent dd23fcb2b2
commit 6e45cff05a

@ -2290,6 +2290,9 @@ static handler_t gw_recv_response(gw_handler_ctx * const hctx, request_st * cons
physpath = r->physical.path.ptr;
}
/*(restore streaming flags removed during authorizer processing)*/
r->conf.stream_response_body |= (hctx->opts.authorizer >> 1);
gw_backend_close(hctx, r);
handler_ctx_clear(hctx);

@ -838,6 +838,12 @@ ajp13_recv_parse (request_st * const r, struct http_response_opts_t * const opts
(r->http_status == 0 || r->http_status == 200)) {
/* authorizer approved request; ignore the content here */
hctx->send_content_body = 0;
opts->authorizer |= /*(save response streaming flags)*/
(r->conf.stream_response_body
& (FDEVENT_STREAM_RESPONSE
|FDEVENT_STREAM_RESPONSE_BUFMIN)) << 1;
r->conf.stream_response_body &=
~(FDEVENT_STREAM_RESPONSE|FDEVENT_STREAM_RESPONSE_BUFMIN);
}
}
else {

@ -445,6 +445,12 @@ static handler_t fcgi_recv_parse(request_st * const r, struct http_response_opts
(r->http_status == 0 || r->http_status == 200)) {
/* authorizer approved request; ignore the content here */
hctx->send_content_body = 0;
opts->authorizer |= /*(save response streaming flags)*/
(r->conf.stream_response_body
& (FDEVENT_STREAM_RESPONSE
|FDEVENT_STREAM_RESPONSE_BUFMIN)) << 1;
r->conf.stream_response_body &=
~(FDEVENT_STREAM_RESPONSE|FDEVENT_STREAM_RESPONSE_BUFMIN);
}
} else if (hctx->send_content_body) {
if (0 != mod_fastcgi_transfer_cqlen(r, hctx->rb, packet.len - packet.padding)) {

@ -24,7 +24,7 @@ typedef struct http_response_opts_t {
uint32_t max_per_read;
int fdfmt;
int backend;
int authorizer; /* bool */
int authorizer; /* bool *//*(maybe overloaded w/ response streaming flags)*/
uint8_t simple_accum; /* bool */
uint8_t local_redir; /* 0,1,2 */
uint8_t xsendfile_allow; /* bool */

Loading…
Cancel
Save