Project

General

Profile

Actions

Bug #2941

closed

failed assertion on incoming bad request when server.error-handler option is used

Added by andpr almost 6 years ago. Updated almost 6 years ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
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)*/
                             }
Actions #1

Updated by gstrauss almost 6 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);
Actions #2

Updated by andpr almost 6 years ago

Sure, you're the expert. Your patch works for me too.
Thanks for the fast feedback.

Actions #3

Updated by gstrauss almost 6 years ago

  • Status changed from New to Patch Pending
  • Target version changed from 1.4.x to 1.4.54
Actions #4

Updated by gstrauss almost 6 years ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100
Actions

Also available in: Atom