Clarify and degrade FastCGI multiplexing
No need to support more than 255 concurrent requests on one connection.
This commit is contained in:
parent
8b334e9c91
commit
14ded260a0
|
@ -124,10 +124,6 @@ struct fcgi_muxer
|
||||||
|
|
||||||
// TODO: bool quitting; that causes us to reject all requests?
|
// TODO: bool quitting; that causes us to reject all requests?
|
||||||
|
|
||||||
/// Requests assigned to request IDs
|
|
||||||
// TODO: allocate this dynamically
|
|
||||||
struct fcgi_request *requests[1 << 16];
|
|
||||||
|
|
||||||
void (*write_cb) (void *user_data, const void *data, size_t len);
|
void (*write_cb) (void *user_data, const void *data, size_t len);
|
||||||
void (*close_cb) (void *user_data);
|
void (*close_cb) (void *user_data);
|
||||||
|
|
||||||
|
@ -136,6 +132,9 @@ struct fcgi_muxer
|
||||||
void (*request_destroy_cb) (void *handler_data);
|
void (*request_destroy_cb) (void *handler_data);
|
||||||
|
|
||||||
void *user_data; ///< User data for callbacks
|
void *user_data; ///< User data for callbacks
|
||||||
|
|
||||||
|
/// Requests assigned to request IDs (may not be FCGI_NULL_REQUEST_ID)
|
||||||
|
struct fcgi_request *requests[1 << 8];
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -284,18 +283,21 @@ fcgi_muxer_on_get_values
|
||||||
nv_parser.output = &values;
|
nv_parser.output = &values;
|
||||||
|
|
||||||
fcgi_nv_parser_push (&nv_parser, parser->content.str, parser->content.len);
|
fcgi_nv_parser_push (&nv_parser, parser->content.str, parser->content.len);
|
||||||
|
const char *key = NULL;
|
||||||
|
|
||||||
struct str_map_iter iter = str_map_iter_make (&values);
|
// No real-world servers seem to actually use multiplexing
|
||||||
while (str_map_iter_next (&iter))
|
// or even issue this request, but we will implement it anyway
|
||||||
{
|
if (str_map_find (&values, (key = FCGI_MPXS_CONNS)))
|
||||||
const char *key = iter.link->key;
|
str_map_set (&response, key, xstrdup ("1"));
|
||||||
|
|
||||||
// TODO: if (!strcmp (key, FCGI_MAX_CONNS))
|
// It's not clear whether FCGI_MAX_REQS means concurrently over all
|
||||||
// TODO: if (!strcmp (key, FCGI_MAX_REQS))
|
// connections or over just a single connection (multiplexed), though
|
||||||
|
// supposedly it's actually per /web server/. Supply the strictest limit.
|
||||||
|
if (str_map_find (&values, (key = FCGI_MAX_REQS)))
|
||||||
|
str_map_set (&response, key,
|
||||||
|
xstrdup_printf ("%zu", N_ELEMENTS (self->requests) - 1));
|
||||||
|
|
||||||
if (!strcmp (key, FCGI_MPXS_CONNS))
|
// FCGI_MAX_CONNS would be basically infinity. We don't limit connections.
|
||||||
str_map_set (&response, key, xstrdup ("1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
struct str content = str_make ();
|
struct str content = str_make ();
|
||||||
fcgi_nv_convert (&response, &content);
|
fcgi_nv_convert (&response, &content);
|
||||||
|
|
Loading…
Reference in New Issue