I recreated this issue with the follow test setup:
busybox httpd running at port 8081 (The simplest HTTP/1.0 server I can think off)
Hiawatha running on port 8080 proxying traffic to the busybox httpd server.
And if you apply the following patch:
diff -urN hiawatha-9.3.1/src/target.c hiawatha-9.3.1-mod/src/target.c
--- hiawatha-9.3.1/src/target.c 2013-11-14 20:15:57.000000000 +0100
+++ hiawatha-9.3.1-mod/src/target.c 2013-11-17 21:51:33.000000000 +0100
@@ -1339,6 +1339,7 @@
bool header_read = false, keep_reading = true, keep_alive, chunked = false;
struct pollfd poll_data;
time_t deadline;
+ int unknown_header = 0;
#ifdef ENABLE_CACHE
t_cached_object *cached_object;
char *cache_buffer = NULL;
@@ -1568,6 +1569,9 @@
*eol = '\r';
}
}
+ } else {
+ printf("Unable to detect HTTP Version (%s)\n",buffer);
+ unknown_header = 1;
}
content_read = bytes_in_buffer - (end_of_header + 4 - buffer);
@@ -1634,6 +1638,10 @@
}
#endif
+ if ( keep_alive == true && unknown_header == 1 ) {
+ printf("\nUnknown header and keeping connection alive.. Will cause socket timeouts\n");
+ }
+
if (keep_alive == false) {
/* Close connection to webserver
You should get some debug messages showing the HTTP response header that it can't recognize:
Unable to detect HTTP Version (HTTP/1.0 200 OK
Content-type: application/octet-stream
Date: Sun, 17 Nov 2013 20:52:14 GMT
Connection: close
Accept-Ranges: bytes
Last-Modified: Sun, 17 Nov 2013 20:35:50 GMT
Content-length: 6
)