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

Use a proxy server if specified #2385

Merged
merged 1 commit into from
Nov 8, 2018
Merged

Conversation

grendello
Copy link
Contributor

Fixes: #2123

Implement proxy support for the Java HTTP client by "translating" the proxy
information specified in HttpClientHandler.Proxy to the format accepted and
expected by the Java client. Since the translation may involve a DNS lookup, it
is performed in a separate task. No caching is attempted in our client code.

Fixes: dotnet#2123

Implement proxy support for the Java HTTP client by "translating" the proxy
information specified in `HttpClientHandler.Proxy` to the format accepted and
expected by the Java client. Since the translation may involve a DNS lookup, it
is performed in a separate task. No caching is attempted in our client code.
@@ -260,7 +260,7 @@ protected virtual IHostnameVerifier GetSSLHostnameVerifier (HttpsURLConnection c
URL java_url = new URL (EncodeUrl (redirectState.NewUrl));
URLConnection java_connection;
if (UseProxy)
java_connection = java_url.OpenConnection ();
java_connection = java_url.OpenConnection (await GetJavaProxy (redirectState.NewUrl, cancellationToken));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this constitute a "redirect"? Do we need to worry about Authentication headers here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't constitute a redirect per se, look at the code a few lines above:

var redirectState = new RequestRedirectionState {
    NewUrl = request.RequestUri,
    RedirectCounter = 0,
    Method = request.Method
};
while (true) {
    URL java_url = new URL (EncodeUrl (redirectState.NewUrl));

if there is a redirect, the URL used here will reflect it, otherwise it's the request URL.

Regarding the authentication headers, we do need to worry about them but they have a separate PR (which timed out and is rebuilding now).

@jonpryor jonpryor merged commit bf07044 into dotnet:master Nov 8, 2018
@grendello grendello deleted the issue2123 branch November 8, 2018 08:13
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants