kazu-yamamoto / mighttpd2

File/CGI web server on Warp
BSD 3-Clause "New" or "Revised" License
136 stars 20 forks source link

Should return 504 instead of 502 when timeout. #8

Closed ownwaterloo closed 10 years ago

ownwaterloo commented 10 years ago

In rfc2612 it is said about 504 Gateway Timeout that :

The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request.

And 502 Bad Gateway:

The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.

I think the correct status code is 504 when upstream don't produce a response back to mighttpd in a reasonable time. I have checked the source code of mighttpd but found nothing about it. Is the status code handled in some libraries which mighttpd depends on?

kazu-yamamoto commented 10 years ago

You can find it in https://github.com/kazu-yamamoto/wai-app-file-cgi/blob/master/Network/Wai/Application/Classic/RevProxy.hs#L108

ownwaterloo commented 10 years ago

OK, with your permission, I would fix it. ありがとう,山本!