Browse Source

[core] disable streaming response with authorizer

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
Glenn Strauss 1 month ago
parent
commit
f96f666ba4
  1. 3
      src/gw_backend.c
  2. 6
      src/mod_ajp13.c
  3. 6
      src/mod_fastcgi.c
  4. 2
      src/response.h

3
src/gw_backend.c

@ -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);

6
src/mod_ajp13.c

@ -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 {

6
src/mod_fastcgi.c

@ -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)) {

2
src/response.h

@ -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