Skip to content
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

Respect http.proxy and http.proxyAuthorization settings #416

Closed
Yanpas opened this issue Feb 8, 2021 · 9 comments · Fixed by #449
Closed

Respect http.proxy and http.proxyAuthorization settings #416

Yanpas opened this issue Feb 8, 2021 · 9 comments · Fixed by #449
Assignees
Labels
bug Something isn't working

Comments

@Yanpas
Copy link

Yanpas commented Feb 8, 2021

Proxy support doesn't work out of the box

@datho7561 datho7561 added the bug Something isn't working label Feb 10, 2021
@datho7561 datho7561 self-assigned this Feb 11, 2021
@datho7561
Copy link
Contributor

As far as I can tell, the client side code (which downloads the XML language server) works through the proxy if you set up http.proxy and set the http.proxySupport setting to override or on. I'll take a look at the language server side next, which is probably where the problem is.

@angelozerr
Copy link
Contributor

Proxy support doesn't work out of the box

Could you explain more please what is your problem with proxy. I suspect that it's a download of DTD, XSD declared in a XML, is that?

@Yanpas
Copy link
Author

Yanpas commented Mar 30, 2021

Yes, schema downloading is the issue

@angelozerr
Copy link
Contributor

angelozerr commented Mar 30, 2021

Do you use binary mode https://github.com/redhat-developer/vscode-xml/blob/354fc8c06757612e292a5a278b67353207324bd9/docs/Preferences.md#server-binary-mode or java mode (have you Java which is installed?)

@datho7561
Copy link
Contributor

datho7561 commented Mar 30, 2021

I managed to get schema downloading to work through a local proxy using the instructions Angelo posted.

@fbricon Do you think it makes sense to pass the VS Code proxy settings to the VM args of the language server?

FYI: it looks to me like Java doesn't resolve localhost in http.proxyHost to 127.0.0.1

@fbricon
Copy link
Collaborator

fbricon commented Mar 30, 2021

I guess we could automatically port the http proxy settings from vscode to their java equivalent, and inject them if the've not been set in vmargs already.
Do we also expose vmargs preferences for the binary?

@datho7561
Copy link
Contributor

Yes, we expose vmargs. I'll work on injecting the properties if they aren't already present in the user-created vmargs.

@datho7561
Copy link
Contributor

This approach (injecting http.proxyHost and http.proxyAuthorization into the JVM arguments) doesn't work with binary. I'll have to look into passing these values to the language server some other way (maybe environment variables). For now, I'll open a draft PR with my work.

datho7561 added a commit to datho7561/vscode-xml that referenced this issue Apr 6, 2021
Interprets the `http.proxyHost` and `http.proxyAuthorization` settings
in order to set up the JVM arguments in order to configure the
proxy for the language server.

This means if the proxy is configured through these settings in VS Code,
then vscode-xml will download schemas through the proxy.

If the proxy is already configured in `xml.server.vmargs`,
then the `http.proxyHost` and `http.proxyAuthorization` are ignored.

Limitations:
 * Does not work with the binary server
 * If `http.proxyAuthorization` is used, it is assumed to be
   [Basic authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization#directives),
   with a username/password pair, since the JVM expects a username/password pair.

Closes redhat-developer#416

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/lemminx that referenced this issue Apr 6, 2021
Reads the proxy configuration from these env:
 * `HTTP_PROXY_HOST`
 * `HTTP_PROXY_PORT`
 * `HTTP_PROXY_USERNAME`
 * `HTTP_PROXY_PASSWORD`

A part of resolving redhat-developer/vscode-xml#416

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/vscode-xml that referenced this issue Apr 6, 2021
Interprets the `http.proxyHost` and `http.proxyAuthorization` settings
in order to set up the JVM arguments or environment variables
in order to configure the proxy for the language server.

JVM arguments are used when running the Java server, and environment
variables are used when running the binary server.

This means if the proxy is configured through these settings in VS Code,
then vscode-xml will download schemas through the proxy.

While running the Java server,
if the proxy is already configured in `xml.server.vmargs`,
then the `http.proxyHost` and `http.proxyAuthorization` are ignored.

Limitations:
 * If `http.proxyAuthorization` is used, it is assumed to be
   [Basic authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization#directives),
   with a username/password pair, since the JVM expects a username/password pair.

Requires eclipse/lemminx#

Closes redhat-developer#416

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/vscode-xml that referenced this issue Apr 6, 2021
Interprets the `http.proxyHost` and `http.proxyAuthorization` settings
in order to set up the JVM arguments or environment variables
in order to configure the proxy for the language server.

JVM arguments are used when running the Java server, and environment
variables are used when running the binary server.

This means if the proxy is configured through these settings in VS Code,
then vscode-xml will download schemas through the proxy.

While running the Java server,
if the proxy is already configured in `xml.server.vmargs`,
then the `http.proxyHost` and `http.proxyAuthorization` are ignored.

Limitations:
 * If `http.proxyAuthorization` is used, it is assumed to be
   [Basic authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization#directives),
   with a username/password pair, since the JVM expects a username/password pair.

Requires eclipse/lemminx#1012

Closes redhat-developer#416

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/vscode-xml that referenced this issue Apr 6, 2021
Interprets the `http.proxyHost` and `http.proxyAuthorization` settings
in order to set up the JVM arguments or environment variables
in order to configure the proxy for the language server.

JVM arguments are used when running the Java server, and environment
variables are used when running the binary server.

This means if the proxy is configured through these settings in VS Code,
then vscode-xml will download schemas through the proxy.

While running the Java server,
if the proxy is already configured in `xml.server.vmargs`,
then the `http.proxyHost` and `http.proxyAuthorization` are ignored.

Limitations:
 * If `http.proxyAuthorization` is used, it is assumed to be
   [Basic authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization#directives),
   with a username/password pair, since the JVM expects a username/password pair.

Requires eclipse/lemminx#1012

Closes redhat-developer#416

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to eclipse/lemminx that referenced this issue Apr 12, 2021
Reads the proxy configuration from these env:
 * `HTTP_PROXY_HOST`
 * `HTTP_PROXY_PORT`
 * `HTTP_PROXY_USERNAME`
 * `HTTP_PROXY_PASSWORD`

A part of resolving redhat-developer/vscode-xml#416

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit that referenced this issue Apr 12, 2021
Interprets the `http.proxyHost` and `http.proxyAuthorization` settings
in order to set up the JVM arguments or environment variables
in order to configure the proxy for the language server.

JVM arguments are used when running the Java server, and environment
variables are used when running the binary server.

This means if the proxy is configured through these settings in VS Code,
then vscode-xml will download schemas through the proxy.

While running the Java server,
if the proxy is already configured in `xml.server.vmargs`,
then the `http.proxyHost` and `http.proxyAuthorization` are ignored.

Limitations:
 * If `http.proxyAuthorization` is used, it is assumed to be
   [Basic authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization#directives),
   with a username/password pair, since the JVM expects a username/password pair.

Requires eclipse/lemminx#1012

Closes #416

Signed-off-by: David Thompson <davthomp@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants