redhat-developer / vscode-xml

Editing XML in Visual Studio Code made easy
Eclipse Public License 2.0
261 stars 81 forks source link

Obey https_proxy settings #764

Closed mwisnicki closed 2 years ago

mwisnicki commented 2 years ago

I have http_proxy and https_proxy set yet the extension is most likely failing to use them.

Please provide better behaviour than jvm defaults which are horrible.

See #134 for details.

angelozerr commented 2 years ago

Have you read https://github.com/redhat-developer/vscode-xml/blob/main/docs/Proxy.md

mwisnicki commented 2 years ago

My http.proxySupport was already set to override. VSCode has not trouble using the proxy. Problem seems specific to vscode-xml.

I want things to work out of the box whenever reasonable.

mwisnicki commented 2 years ago

Although I also tried JVM args (http.proxyHost etc) through xml.server.binary.args as well as JAVA_TOOL_OPTIONS and neither seems to work ("Connection refused") even though the latter is being logged in extension log file so perhaps the problem lies elsewhere.

angelozerr commented 2 years ago

@datho7561 have you some idea?

datho7561 commented 2 years ago

@mwisnicki have you tried following these instructions: https://github.com/redhat-developer/vscode-xml/blob/main/docs/Preferences.md#setting-up-proxy ? Make sure you set both the HTTP and HTTPS proxies.

The extension should use the VS Code proxy settings to download schemas. Unfortunately, there was a bug in the implementation, and this was only being configured for HTTP and not HTTPS (see #735). I made a fix for this a while ago, but we haven't released a new version of the extension since then. If you are able to, try enabling the preview version of the extension and see if that fixes it.

If there is some other issue beyond this, please let me know.

@angelozerr I think we should do a release soon to address this, what do you think?

mwisnicki commented 2 years ago

Yes I have the proxy setup.

Switched to pre-release. Still failing in CacheResourcesManager lambda$downloadResource$0() With http url I'm getting [java.io.FileNotFoundException] http://maven.apache.org/xsd/maven-4.0.0.xsd while with https it's [java.net.ConnectException] Connection refused: connect.

datho7561 commented 2 years ago

Okay. Are you using any sort of Authorization with the proxy? I have only tried with Basic authorization and without any authorization.

mwisnicki commented 2 years ago

Doh, I had a typo in proxyPort! So both work if I set JVM flags and pre-release version even follows redirects.

However neither obeys vscode proxy settings and http.proxySupport=override so this bug still stands.

mwisnicki commented 2 years ago

Not using authorization directly. Have cntlm and

http_proxy=http://localhost:3128
https_proxy=$http_proxy
datho7561 commented 2 years ago

Okay, thanks for your help. Just to confirm I understand correctly, you set up the proxy in VS Code using environment variables? We have code in place to read the VS Code setting http.proxy, but not to use the http_proxy/https_proxy environment variables, so I'll take a look into implementing this.

mwisnicki commented 2 years ago

Okay, thanks for your help. Just to confirm I understand correctly, you set up the proxy in VS Code using environment variables? We have code in place to read the VS Code setting http.proxy, but not to use the http_proxy/https_proxy environment variables, so I'll take a look into implementing this.

Yes. Thanks for looking into this. IMHO it should be on VS Code to provide single consistent way of obtaining proxy by extensions.

datho7561 commented 2 years ago

Looks like the nightly build for the prerelease went through. If you have time, please let me know if this fixed your issue