http icon indicating copy to clipboard operation
http copied to clipboard

HPE_INVALID_HEADER_TOKEN on 5.3.1 and 5.2.0

Open pineman opened this issue 5 months ago • 1 comments

Hi!

Doing a simple HTTP.get("http://www.aplhealthcare.com.au") results in error reading from socket: Error Parsing data: HPE_INVALID_HEADER_TOKEN Invalid header value char (HTTP::SocketReadError) on 5.3.1 and 5.2.0, but NOT on 5.3.0. I'm using ruby 3.4.5.

I think it's due to the response's headers using \n instead of \r\n ("HTTP/1.1 301 Found\nDate: Fri Aug 1 23:02:05 2025\nServer: Redirector - NetRegistry Pty Ltd\nLocation: http://www.shop.livcor.com.au\nConnection: close\n\n\n", captured from parser.rb:29). But something fishy is going on because on 5.3.0 this works fine, probably due to the native llhttp?

Another example is https://bydenergy.com. Would appreciate some guidance on why it works on 5.3.0 but not 5.3.1 or 5.2.0. I believe it works on 5.1.1 too. Thanks.

pineman avatar Aug 01 '25 13:08 pineman

The native llhttp seems like the most likely reason, and if so, the difference in behavior between the native and FFI version is something that's beyond our control

tarcieri avatar Aug 01 '25 13:08 tarcieri