First off, this is maybe not a bug in hiawatha but in libevhtp, but I wanted to hear your opinion on it.
I noticed a problem when using the reverse proxy to send large requests to a libevhtp (https://github.com/ellzey/libevhtp) server.
I originally saw this issue with seafile (see https://github.com/haiwen/seafile/issues/1229), but it can be reproduced using just curl and libevhtp itself (the included test_basic to be specific).
Basically, curl does not receive a final http response and so waits until it hits its timeout:
$ curl -v --data-binary @200KiB.txt http://domain.test/simple/
* Trying 127.0.0.1...
* Connected to domain.test (127.0.0.1) port 80 (#0)
> POST /simple/ HTTP/1.1
> Host: domain.test
> User-Agent: curl/7.42.1
> Accept: */*
> Content-Length: 204800
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
* Done waiting for 100-continue
< HTTP/1.1 100 Continue
* Empty reply from server
* Connection #0 to host domain.test left intact
curl: (52) Empty reply from server
This does not occur when contacting libevhtp directly or when leaving out the "Expect: 100-continue":
$ curl -v --data-binary @200.txt http://localhost:8081/simple/
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8081 (#0)
> POST /simple/ HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.42.1
> Accept: */*
> Content-Length: 204800
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Content-Length: 6
< Content-Type: text/plain
<
* Connection #0 to host localhost left intact
simple
# curl -v -H "Expect:" --data-binary @200.txt http://domain.test/simple/
* Trying 127.0.0.1...
* Connected to domain.test (127.0.0.1) port 80 (#0)
> POST /simple/ HTTP/1.1
> Host: domain.test
> User-Agent: curl/7.42.1
> Accept: */*
> Content-Length: 204800
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 200 OK
< Content-Length: 6
< Content-Type: text/plain
<
* Connection #0 to host domain.test left intact
simple
The hiawatha log looks like this:
::|Thu 28 May 2015 19:08:11 +0200|100|205228||POST /simple/ HTTP/1.1|Host: domain.test|User-Agent: curl/7.42.1|Accept: */*|Content-Length: 204800|Content-Type: application/x-www-form-urlencoded|Expect: 100-continue
::|Thu 28 May 2015 19:08:23 +0200|200|205251||POST /simple/ HTTP/1.1|Host: domain.test|User-Agent: curl/7.42.1|Accept: */*|Content-Length: 204800|Content-Type: application/x-www-form-urlencoded
The configuration is relatively standard:
VirtualHost {
Hostname = domain.test
WebsiteRoot = /srv/http/domain.test/www
WebDAVapp = yes
ReverseProxy .* http://127.0.0.1:8081 60
}
So this is either a bug in hiawatha or libevhtp gets confused whit hiawatha's "Expect" handling. (see https://www.hiawatha-webserver.org/forum/topic/1613/)
I suppose it is the latter, because I captured the conversation between hiawatha and libevhtp in the seafile issue (linked above) and libevhtp just did not send a response (except for the "HTTP/1.1 100 Continue").
I could also provide tcpdumps for this example, if it helps.
Thanks!