From f1f125ec8d710e4818291bab36a47b42f585bd07 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 13 Jun 2010 15:11:44 +0000 Subject: fix NPE --- src/daemon/connection.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/daemon/connection.c b/src/daemon/connection.c index efa27a46..5a4b6f71 100644 --- a/src/daemon/connection.c +++ b/src/daemon/connection.c @@ -579,6 +579,7 @@ build_header_response (struct MHD_Connection *connection) enum MHD_ValueKind kind; const char *reason_phrase; + EXTRA_CHECK (NULL != connection->version); if (0 == strlen(connection->version)) { data = MHD_pool_allocate (connection->pool, 0, MHD_YES); @@ -673,7 +674,12 @@ transmit_error_response (struct MHD_Connection *connection, { struct MHD_Response *response; - /* die, header far too long to be reasonable */ + if (connection->version == NULL) + { + /* we were unable to process the full header line, so we don't + really know what version the client speaks; assume 1.0 */ + connection->version = MHD_HTTP_VERSION_1_0; + } connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; connection->read_closed = MHD_YES; #if HAVE_MESSAGES -- cgit v1.2.3