diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-13 15:11:44 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-13 15:11:44 +0000 |
commit | f1f125ec8d710e4818291bab36a47b42f585bd07 (patch) | |
tree | 8f57af8b241435888241a30b9e7adf633118b3bc | |
parent | ee092d7c12979e9dc9c463e83c98345455b672ff (diff) | |
download | libmicrohttpd-f1f125ec8d710e4818291bab36a47b42f585bd07.tar.gz libmicrohttpd-f1f125ec8d710e4818291bab36a47b42f585bd07.zip |
fix NPE
-rw-r--r-- | src/daemon/connection.c | 8 |
1 files changed, 7 insertions, 1 deletions
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) | |||
579 | enum MHD_ValueKind kind; | 579 | enum MHD_ValueKind kind; |
580 | const char *reason_phrase; | 580 | const char *reason_phrase; |
581 | 581 | ||
582 | EXTRA_CHECK (NULL != connection->version); | ||
582 | if (0 == strlen(connection->version)) | 583 | if (0 == strlen(connection->version)) |
583 | { | 584 | { |
584 | data = MHD_pool_allocate (connection->pool, 0, MHD_YES); | 585 | data = MHD_pool_allocate (connection->pool, 0, MHD_YES); |
@@ -673,7 +674,12 @@ transmit_error_response (struct MHD_Connection *connection, | |||
673 | { | 674 | { |
674 | struct MHD_Response *response; | 675 | struct MHD_Response *response; |
675 | 676 | ||
676 | /* die, header far too long to be reasonable */ | 677 | if (connection->version == NULL) |
678 | { | ||
679 | /* we were unable to process the full header line, so we don't | ||
680 | really know what version the client speaks; assume 1.0 */ | ||
681 | connection->version = MHD_HTTP_VERSION_1_0; | ||
682 | } | ||
677 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; | 683 | connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; |
678 | connection->read_closed = MHD_YES; | 684 | connection->read_closed = MHD_YES; |
679 | #if HAVE_MESSAGES | 685 | #if HAVE_MESSAGES |