ninenines / cowlib

Support library for manipulating Web protocols.
ISC License
279 stars 173 forks source link

Allow content-length in 204 reply #119

Closed Zert closed 2 years ago

Zert commented 2 years ago

Some servers are sending content-length=0 header in the response with 204 code. Cowlib reset this connection with stream error: https://github.com/ninenines/cowlib/blob/master/src/cow_http2_machine.erl#L744 May be cowlib should handle content-length of 204 with value 0?

Similar issue in jdk: https://bugs.openjdk.java.net/browse/JDK-8218662

essen commented 2 years ago

The code you linked to is for HTTP/2. The related issue is for HTTP/1.1.

Please be more specific as to which server(s) you are having this issue with, as well as which protocol is impacted exactly.

Zert commented 2 years ago

Yes, the related issue is really for HTTP/1.1, but I have that behaviour with HTTP/2 and Google servers, like www.google-analytics.com

essen commented 2 years ago

Please be more specific. Examples of requests and/or server name and/or relevant output.

Zert commented 2 years ago

Unfortunately, I cannot repeat this case, since it is very rare. May be depends on IP address of server of something else. I've found this error in logs.

Zert commented 2 years ago

So may be it is better to patch cowlib locally in case this is not the common problem.

essen commented 2 years ago

Yes because I need to know which servers are breaking the spec to know when I can remove the workaround again once it doesn't cause a problem anymore. But I am happy to receive further information when/if you get any and act on it.