Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support NTLM protocol with the proxy: fixed the header name for Proxy-Authorization #563

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

Merged
slandelle merged 1 commit into AsyncHttpClient:1.8.x from artnaseef:1.8.x
Jun 3, 2014

Conversation

@artnaseef
Copy link

@artnaseef artnaseef commented Jun 2, 2014

Support for NTLM proxies, using the Netty provider, did not appear to function due to the wrong header name being used on the second request from the client to the server in the handshake: Authorization should be Proxy-Authorization.

Attached is a pull request that fixes the problem against 1.8.10-SNAPSHOT.

Here's a snippet of code that shows how the NTLM proxy is configured.

/**
 * Configure the Async HTTP Client
 */
protected AsyncHttpClientConfig getConfig () {
 AsyncHttpClientConfig.Builder configBuilder = new AsyncHttpClientConfig.Builder();
 if ( ntlmDomain != null ) {
 configBuilder
 .setRealm(new Realm.RealmBuilder()
 .setPrincipal(this.username)
 .setPassword(this.password)
 .setNtlmDomain(this.ntlmDomain)
 .setUsePreemptiveAuth(true)
 .build());
 }
 return configBuilder.build();
}
public void execute () {
 AsyncHttpClientConfig config = this.getConfig();
 this.client = new AsyncHttpClient(config);
 try {
 Future<WebSocket> futureWebsocket;
 ProxyServer proxy = new ProxyServer(this.proxyProtocol, this.proxyServer, this.proxyServerPort,
 this.username, this.password);
 if ( ntlmDomain != null ) {
 proxy.setNtlmDomain(ntlmDomain);
 }
 futureWebsocket =
 this.client.prepareGet(this.wsUrl)
 .setProxyServer(proxy)
 .execute(new WebSocketUpgradeHandler.Builder().build());
 LOG.info("waiting for websocket connection");
 final WebSocket websocket = futureWebsocket.get();
 if ( websocket != null ) {
 LOG.info("received websocket connection");
 websocket.addWebSocketListener(new WebSocketTextListener() {
 @Override
 public void onMessage(String s) {
 LOG.info("received response {}", s);
 processAgentRequest(websocket, s);
 }
 ...
}

@slandelle slandelle added this to the 1.8.10 milestone Jun 3, 2014
@slandelle slandelle self-assigned this Jun 3, 2014
slandelle pushed a commit that referenced this pull request Jun 3, 2014
Support NTLM protocol with the proxy: fixed the header name for Proxy-Authorization
@slandelle slandelle merged commit 9a520e4 into AsyncHttpClient:1.8.x Jun 3, 2014
Copy link
Contributor

Thanks!
Will port on master.

slandelle pushed a commit that referenced this pull request Jun 3, 2014
Copy link
Author

Awesome - thank you!

Do you have an ETA on the next 1.8.x release (1.8.10?)? It would be awesome to avoid keeping a fork for any length of time.

Oh, and thanks for this awesome project. We're using it for WebSockets behind proxies, and it's going great so far!

Copy link
Contributor

jfarcand commented Jun 5, 2014

@artnaseef I can cut the release as soon as next week. @slandelle , what do you think?

Copy link
Contributor

Whenever you want.

2014年06月06日 0:37 GMT+02:00 Jeanfrancois Arcand notifications@github.com:

@artnaseef https://github.com/artnaseef I can cut the release as soon
as next week. @slandelle https://github.com/slandelle , what do you
think?


Reply to this email directly or view it on GitHub
#563 (comment)
.

Copy link
Author

@jfarcand - next week would be excellent! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Projects

None yet

Milestone

1.8.10

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /