scalaj-http
scalaj-http copied to clipboard
Close Socket
Is there a way to close the underlying TCP socket that's been opened by scalaj-http?
For example, with HttpUrlConnection I can do the following: HttpURLConnection.getInputSteam().close().
I'm having issues with a Proxy timing out because, according to them, each socket should be opened for an individual HTTP request (and then closed). I think the socket connection is being cached.
Let me know if I can clarify this further. I might have missed something in the README.
Okay after reviewing the source code, it does indeed look like there is a close() method being called on this line: https://github.com/scalaj/scalaj-http/blob/master/src/main/scala/scalaj/http/Http.scala#L394
Am I misunderstanding HttpUrlConnection or does close actually sever the underlying socket? Does it get cached anyways?
If it is being closed, then we can start to suspect a problem downstream.
I think it is probably being cached if the server supports keep-alive. See the sun implementation notes from java6: http://docs.oracle.com/javase/6/docs/technotes/guides/net/http-keepalive.html
Looks like setting "connection: close" in the request header should help although I haven't tested myself.
On Thursday, February 4, 2016, crockpotveggies [email protected] wrote:
Okay after reviewing the source code, it does indeed look like there is a close() method being called on this line: https://github.com/scalaj/scalaj-http/blob/master/src/main/scala/scalaj/http/Http.scala#L394
Am I misunderstanding HttpUrlConnection or does close actually sever the underlying socket? Does it get cached anyways?
If it is being closed, then we can start to suspect a problem downstream.
— Reply to this email directly or view it on GitHub https://github.com/scalaj/scalaj-http/issues/90#issuecomment-179983690.
Did that work for you?
Hey thanks for following up! Had prioritize something but I'll try connection close again tomorrow and let you know. Thanks for checking in On Tue, Mar 1, 2016 at 7:46 PM Jon Hoffman [email protected] wrote:
Did that work for you?
— Reply to this email directly or view it on GitHub https://github.com/scalaj/scalaj-http/issues/90#issuecomment-191043414.