cocoa-rest-client icon indicating copy to clipboard operation
cocoa-rest-client copied to clipboard

Connection header always keep-alive

Open tim-brown-kony opened this issue 11 years ago • 3 comments

Hi there,

The requests being generated appear to be always sent with a header Connection:keep-alive. I tried explicitly adding a header Connection:close but this is being ignored.

Any suggestions would be appreciated.

Thanks

Tim

tim-brown-kony avatar Feb 21 '14 00:02 tim-brown-kony

Hmm good catch. It must have something to do with the Cocoa URL connection implementation. I managed to find a thread from 2005 referencing this very situation (http://lists.apple.com/archives/macnetworkprog/2005/Oct/msg00030.html) but in the spirit of the pre-StackOverflow internet, I don't see an answer. I'll investigate more...

mmattozzi avatar Feb 22 '14 00:02 mmattozzi

I experienced the same result. In addition, The "Connection: keep-alive" doesn't appear in the "Sent Headers" tab.

According to some the answer is setting request.setValue("close", forKey: "Connection")

https://stackoverflow.com/questions/35441584/how-can-i-add-the-http-header-connection-close-correctly-in-swift However, there is mention of that 2005 thread.

"Accept: /" header is also sent -- but it can be overridden and does show in the "Sent Headers" tab.

I like the cut and paste curl command. Nice project overall.

adrianboston avatar Jan 08 '20 06:01 adrianboston

Thanks, you're inspiring me to take another look at this.

mmattozzi avatar Jan 08 '20 23:01 mmattozzi