Flurl icon indicating copy to clipboard operation
Flurl copied to clipboard

Problem changing the "Connection" header

Open timh52280 opened this issue 1 year ago • 1 comments

Good afternoon for some reason the server to which I am making the request does not answer me if the header "Connection" has the value "Keep-Alive", I have to change this value to its lowercase version "keep-alive" but I have investigated without success, is there any way to change this header with Flurl? I have tried to change it using:

client.Headers.AddOrReplace("Connection", "keep-alive");

But when I see the header, it looks like this:

Connection: keep-alive,Keep-Alive

It is re-adding the header value instead of replacing it.

timh52280 avatar Jul 16 '22 17:07 timh52280

It appears to be a Windows problem. Others have discovered it in HttpClient, which Flurl sits on top of:

https://stackoverflow.com/questions/9650236/how-to-send-lower-case-keep-alive-header-through-httpwebrequest https://stackoverflow.com/questions/37005125/how-to-set-connection-keep-alive-header-in-lower-case-through-httpclient https://stackoverflow.com/questions/28250722/make-httpheader-connection-keep-alive-into-lower-case-keep-alive

When the best answer appears to be "use reflection to call a private method", that's a sign that I don't want to touch it 😄. Whoever owns that service, are they aware that pretty much anyone on a Windows platform is going to have this problem, and that Connection values should not be case-sensitive?

tmenier avatar Jul 29 '22 21:07 tmenier