Opened 8 years ago
Closed 8 years ago
#13347 closed bug (fixed)
PoorMan hangs for HEAD request
Reported by: | kainjow | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | Applications/PoorMan | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
If you send a HEAD request to PoorMan, it hangs. For example from the Terminal:
curl --HEAD http://x.x.x.x
It does *not* hang if you send an unsupported request method, for example:
curl -X PURGE http://x.x.x.x
hrev50953 x86_gcc2
Attachments (2)
Change History (10)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
It will not hang if the URL returns 404, but if it returns 200 normally then it will hang. For example this works:
curl --HEAD http://x.x.x.x/asdf
by , 8 years ago
Attachment: | 0001-Fix-PoorMan-hanging-on-HEAD-requests.patch added |
---|
comment:3 by , 8 years ago
patch: | 0 → 1 |
---|
comment:5 by , 8 years ago
It seems this "pointer" can only ever be set to 0 or 1. While we are touching this code, I think it should be converted to a bool and probably renamed to say what it does (obviously it is not a file_address).
Since the code is a bit unclear, an explanation of your changes in the commit message would also be appreciated (what was the problem, and why it is now solved).
Also it seems the only use for this is counting hits from the webserver. Does that still work as expected? (counting only real "hits", not 404 or other errors, and I would think not HEAD requests).
comment:6 by , 8 years ago
Yes, the use of a pointer as a bool is a questionable, I just didn't want to mess with refactoring yet. The libhttpd code looks like it was hacked to death to make it work. An ideal refactor would be to update libhttpd to latest verison, scrap all unnecessary changes, and handle directory listings in PoorManServer.
Hits are still only incremented for normal 200 requests, whether it's from a file or a directory listing. Invalid or HEAD/POST requests do not change it.
Actually, looks like it's not all the way fixed yet. Still hangs for a 200 directory listing request. I'll fix it and provide a more in-depth commit message.
by , 8 years ago
Attachment: | 0001-Fix-client-hang-when-HEAD-request-is-sent-to-PoorMan.patch added |
---|
comment:7 by , 8 years ago
This patch should fix it now. I also did the refactor of the variable. Looks like libhttpd actually has a bug in it with handling HEAD directory listing requests. The latest code at http://acme.com/software/thttpd/ seems to still have this.
If I send a HEAD request to http://haiku-os.org it works fine, so it's not an issue with curl.