Error response in linux listener

Mar 5, 2014 at 9:51 AM
Edited Mar 5, 2014 at 10:05 AM
Hello all,

thanks for this great piece of software.
We are using the http_listener (master branch) in linux to implement a REST api and everything seems to work smooth, but we have a small problem with the error cases.
Althought the error is reported as it should be, the connection "stays" alive. Is this the desired behaviour? Is it client issue? The issue can be easilly reproduced with the blackjackserver:

Listening for requests at: http://localhost:34568/blackjack/dealer
Press ENTER to exit.
GET http://localhost:34568/blackjack/dealer HTTP/1.1
Accept: */*
Host: localhost:34568
User-Agent: curl/7.29.0

GET http://localhost:34568/blackjack/dealer/4343 HTTP/1.1
Accept: */*
Host: localhost:34568
User-Agent: curl/7.29.0

GET http://localhost:34568/blackjack/dealer/32323 HTTP/1.1
Accept: */*
Host: localhost:34568
User-Agent: curl/7.29.0
Using curl as client:
#curl -i -k http://localhost:34568/blackjack/dealer
HTTP/1.1 200 OK
Content-Length: 130
Content-Type: application/json


# curl -i -k http://localhost:34568/blackjack/dealer/4343
HTTP/1.1 404 Not Found

(stays pending, have to interrupt to exit) 

# curl  -f -i -k http://localhost:34568/blackjack/dealer/32323
curl: (22) The requested URL returned error: 404 Not Found
thanks in advance,

Mar 10, 2014 at 8:36 PM
Hi Apostolos,

We've reproduced the issue you've described and are working on a solution. Thanks for the report; we'll hopefully have more info soon.

Mar 10, 2014 at 8:59 PM
Hi again,

You've definitely hit a bug here, so thanks for bringing it to our attention. Turns out http_listener does not specify a Content-Length and does not close the connection when sending a default 404, which causes the client to wait indefinitely for a response.

We won't be able to include the fix in the next release, but we will certainly fix it for the release after.

If this behavior is a critical issue, you can work around it by sending your own custom 404 messages.

Marked as answer by amanol on 3/14/2014 at 5:22 AM