Actions
Bug #2941
closedfailed assertion on incoming bad request when server.error-handler option is used
ASK QUESTIONS IN Forums:
Description
Hi,
I'm using mod_scgi and the server.error-handler option. If a bad http request comes in, the lighttpd server hits an assertion when preparing the headers for the scgi execution.
http-header-glue.c.1431: assertion failed: s
Initializing the con->request.http_version field in the error_handler case makes this assertion disappear.
--- lighttpd-1.4.53-org/src/connections.c 2019-01-27 10:22:20.000000000 +0100 +++ lighttpd-1.4.53-patched/src/connections.c 2019-03-12 09:54:18.663685376 +0100 @@ -1221,6 +1221,7 @@ con->error_handler_saved_method = con->request.http_method; con->request.http_method = HTTP_METHOD_GET; + con->request.http_version = HTTP_VERSION_1_1; } else { /*(preserve behavior for server.error-handler-404)*/ con->error_handler_saved_status = -con->http_status; /*(negative to flag old behavior)*/ }
Updated by gstrauss over 5 years ago
Thanks for the patch. I think this is more generic and more correct for a wider variety of clients.
--- a/src/connections.c +++ b/src/connections.c @@ -1192,6 +1192,7 @@ static int connection_handle_request(server *srv, connection *con) { } else { /*(preserve behavior for server.error-handler-404)*/ con->error_handler_saved_status = -con->http_status; /*(negative to flag old behavior)*/ } + if (con->request.http_version == HTTP_VERSION_UNSET) con->request.http_version = HTTP_VERSION_1_0; buffer_copy_buffer(con->request.uri, error_handler); connection_handle_errdoc_init(con);
Updated by andpr over 5 years ago
Sure, you're the expert. Your patch works for me too.
Thanks for the fast feedback.
Updated by gstrauss over 5 years ago
- Status changed from New to Patch Pending
- Target version changed from 1.4.x to 1.4.54
Updated by gstrauss over 5 years ago
- Status changed from Patch Pending to Fixed
- % Done changed from 0 to 100
Applied in changeset 5440f04e8a9476e9a8665a93db3934a566f8beec.
Actions
Also available in: Atom