Skip to content

Commit 65e7c6c

Browse files
committed
Fix https proxy handling
1 parent faa6fca commit 65e7c6c

File tree

3 files changed

+17
-26
lines changed

3 files changed

+17
-26
lines changed

client/src/main/java/org/asynchttpclient/netty/handler/intercept/ConnectSuccessInterceptor.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.io.IOException;
2020

21+
import org.asynchttpclient.Realm;
2122
import org.asynchttpclient.Request;
2223
import org.asynchttpclient.RequestBuilder;
2324
import org.asynchttpclient.netty.NettyResponseFuture;
@@ -28,6 +29,8 @@
2829
import org.slf4j.Logger;
2930
import org.slf4j.LoggerFactory;
3031

32+
import static org.asynchttpclient.Dsl.realm;
33+
3134
public class ConnectSuccessInterceptor {
3235

3336
private static final Logger LOGGER = LoggerFactory.getLogger(ConnectSuccessInterceptor.class);
@@ -54,6 +57,13 @@ public boolean exitAfterHandlingConnect(//
5457
Uri requestUri = request.getUri();
5558
LOGGER.debug("Connecting to proxy {} for scheme {}", proxyServer, requestUri.getScheme());
5659

60+
if (future.getProxyRealm() != null && future.getProxyRealm().getScheme() == Realm.AuthScheme.BASIC) {
61+
Realm newBasicRealm = realm(future.getProxyRealm())
62+
.setUsePreemptiveAuth(false)
63+
.build();
64+
future.setProxyRealm(newBasicRealm);
65+
}
66+
5767
channelManager.upgradeProtocol(channel.pipeline(), requestUri);
5868
future.setReuseChannel(true);
5969
future.setConnectAllowed(false);

netty-bp/resolver/src/test/java/io/netty/resolver/HostsFileParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void testParse() throws IOException {
4444

4545
Map<String, InetAddress> entries = HostsFileParser.parse(new BufferedReader(new StringReader(hostsString)));
4646

47-
assertEquals("Expected 6 entries", 6, entries.size());
47+
assertEquals("Expected 7 entries", 7, entries.size());
4848
assertEquals("127.0.0.1", entries.get("host1").getHostAddress());
4949
assertEquals("192.168.0.1", entries.get("host2").getHostAddress());
5050
assertEquals("192.168.0.2", entries.get("host3").getHostAddress());

pom.xml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<parent>
4-
<groupId>org.sonatype.oss</groupId>
5-
<artifactId>oss-parent</artifactId>
6-
<version>9</version>
4+
<groupId>ru.headhunter.commons</groupId>
5+
<artifactId>common-pom</artifactId>
6+
<version>1.25</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<groupId>org.asynchttpclient</groupId>
@@ -18,9 +18,9 @@
1818
</description>
1919
<url>http://github.com/AsyncHttpClient/async-http-client</url>
2020
<scm>
21-
<url>https://github.com/AsyncHttpClient/async-http-client</url>
22-
<connection>scm:git:[email protected]:AsyncHttpClient/async-http-client.git</connection>
23-
<developerConnection>scm:git:[email protected]:AsyncHttpClient/async-http-client.git</developerConnection>
21+
<url>https://github.com/Aulust/async-http-client</url>
22+
<connection>scm:git:[email protected]:Aulust/async-http-client.git</connection>
23+
<developerConnection>scm:git:[email protected]:Aulust/async-http-client.git</developerConnection>
2424
</scm>
2525
<issueManagement>
2626
<system>jira</system>
@@ -214,25 +214,6 @@
214214
</properties>
215215
</profile>
216216
</profiles>
217-
<distributionManagement>
218-
<repository>
219-
<id>sonatype-nexus-staging</id>
220-
<name>Sonatype Release</name>
221-
<url>http://oss.sonatype.org/service/local/staging/deploy/maven2
222-
</url>
223-
</repository>
224-
<snapshotRepository>
225-
<id>sonatype-nexus-snapshots</id>
226-
<name>sonatype-nexus-snapshots</name>
227-
<url>${distMgmtSnapshotsUrl}</url>
228-
</snapshotRepository>
229-
</distributionManagement>
230-
<repositories>
231-
<repository>
232-
<id>maven.java.net</id>
233-
<url>https://maven.java.net/content/repositories/releases</url>
234-
</repository>
235-
</repositories>
236217
<modules>
237218
<module>netty-bp</module>
238219
<module>client</module>

0 commit comments

Comments
 (0)