hackney icon indicating copy to clipboard operation
hackney copied to clipboard

Status codes as floats

Open luoken opened this issue 2 years ago • 2 comments

There seems to be some sites that return status codes as floats e.g. http://www.lowiqcanadian.com/id2.html.

When running curl --head http://www.lowiqcanadian.com/id2.html we see that the status code returned is actually a 401.1 and hackney does not like that as it tries to convert the float into an integer.

Here are some status codes that are floats: https://docs.microsoft.com/en-us/troubleshoot/iis/http-status-code

luoken avatar Nov 09 '21 00:11 luoken

I was curious about this because the HTTP spec defines the status code as 3 digit integer. I wouldn't be surprised that IIS breaks the spec but when I curl that url I get a 404.

Either way I don't think hackney should support it but I'm curious to see if it actually returns 401.1 and that is able to be handled by curl.

tsloughter avatar Aug 03 '22 20:08 tsloughter

The spec indeed defines it as a 3 digit integer : https://datatracker.ietf.org/doc/html/rfc7231#section-6

This is a low priority actually to support microsoft insanity and will come after the new connection engine but i think this can be done. Of course Microsoft pushed the insanity to the point it can be more than one digit after which makes things slower to check but we can actually parse it digit by digit. It will be slower though.

benoitc avatar Aug 04 '22 06:08 benoitc