-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jetty http client SSL connectivity over CNTLM proxy fails #6483
Comments
The log attached |
The logs shows this request:
and this response:
So the server is telling the client that it's closing the connection. It's a buggy proxy, ask them to not send the |
Does not this mean that the proxy requests close after the exchange is complete? Basically don't send other HTTP requests via the same pipe. Jetty client appears to close right away unlike other clients. This header appears to be sent back by CNTLM unless upstream proxy sends keep-alive back, which seems incorrect if I read HTTP 1.1. spec right |
The exchange between client and proxy is completed: a The client asked for a tunnel, the server is replying 200 with a "Keep-alive" is a thing of 20+ years ago. Ignoring the header won't be correct, as the connection cannot be reused ever by the client, so the only option is to close it -- keeping it around would just waste resources. I assume |
It is not configurable. Culprit code on the line 767 here is 11 years old. This code appears to replicate HTTP/1.0 spec, rather than HTTP/1.1. And removing it indeed allows jetty client to function properly. It is just curious that in 10+ years of using CNTLM jetty client is the first client that I noticed issue. So my instinct was to assume it is the client bug. |
@arykov the versat/cntlm project seems maintained, perhaps you can open an issue there. If you have done this scavenging, do you know what for example |
I tried curl, wget and chrome and captured tcpdump.zip (attached all but chrome and there are two curl dumps with -L and not) and they all seem to ignore close(note the "source" port that remains the same). Further I captured curl log |
@arykov I would open an issue anyway to @gregw what do you think? That a proxy sends an explicit I would rather push back and have the issue fixed in the proxy, than to introduce a special handling in Jetty's |
Although I created an issue and pull request for CNTLM, I don't anticipate this fix trickling downstream any time soon. Ubuntu and Redhat/centos packages still reference its old home on the sourceforge which has not been showing too much life since 2012 |
@arykov we will discuss if it's the case for Jetty's |
@sbordet I've seen it argued that the entire conversation is the body of a CONNECT response, so that if you accept that, then the close applies after the conversation. I'm not sure I agree, but then I'm not sure I don't. So if the work around is simple.... |
Maybe you could help getting a newer version version of the fork packages for distributions you use? :) At least a PPA/COPR with newer cntlm packages would be nice. A next step would be seeing if something could be submitted to Debian/Fedora (to get it in turn into Ubuntu/RHEL). |
This issue has been automatically marked as stale because it has been a |
Now Connection: close is ignored for 2xx responses to a CONNECT method. In this way the tunnel is kept open, and bad proxies that were sending Connection: close are now supported as apparently they are still out there. Fixes also #6483. Signed-off-by: Simone Bordet <[email protected]>
Now Connection: close is ignored for 2xx responses to a CONNECT method. In this way the tunnel is kept open, and bad proxies that were sending Connection: close are now supported as apparently they are still out there. Fixes also #6483. Signed-off-by: Simone Bordet <[email protected]>
Jetty version(s)
9.4.36.v20210114.
Java version/vendor
(use: java -version)
1.8.0_281
OS type/version
Windows 10
Description
This is taking place in an environment where internet access can only be performed over a forward proxy(blue coat from what I can tell) that has the following characteristics:
In order to deal with the NTLM cntlm chained proxy is being run, so that http client does not need to deal with this.
Now when cntlm proxy is used, wget, curl, java in built http client are able to access https and http endpoints
Unfortunately Jetty http client does not appear to be able to access https endpoints this way due to SSLHandshakeException caused by ClosedChannelException. Cannot post the full stack trace at the moment
Would be great to get troubleshooting
How to reproduce?
Used ubuntu, but any distro should work
Setup:
Reproduce
It works for curl:
a) export http_proxy=http://localhost:3129
b)export https_proxy=http://localhost:3129
c) curl https://cnn.com
It fails if using the following code:
The text was updated successfully, but these errors were encountered: