Skip to content

Commit ce051b4

Browse files
authored
Rollback #747 with comments (#1510)
Also the added UTs made no sense from retrospective, as they used HTTP remote repo with HTTPS proxy, something Maven would never do. Rolls back #747 but leaves traces and some context. Ref apache/maven#2519
1 parent 3b0c7eb commit ce051b4

File tree

2 files changed

+5
-37
lines changed

2 files changed

+5
-37
lines changed

maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,11 @@ private InetAddress getBindAddress(RepositorySystemSession session, RemoteReposi
382382
private static HttpHost toHost(Proxy proxy) {
383383
HttpHost host = null;
384384
if (proxy != null) {
385-
host = new HttpHost(proxy.getHost(), proxy.getPort(), proxy.getType());
385+
// in Maven, the proxy.protocol is used for proxy matching against remote repository protocol; no TLS proxy
386+
// support
387+
// https://github.com/apache/maven/issues/2519
388+
// https://github.com/apache/maven-resolver/issues/745
389+
host = new HttpHost(proxy.getHost(), proxy.getPort());
386390
}
387391
return host;
388392
}

maven-resolver-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpTransporterTest.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -391,27 +391,6 @@ public void testGetProxyAuthenticated() throws Exception {
391391
assertEquals(task.getDataString(), new String(listener.baos.toByteArray(), StandardCharsets.UTF_8));
392392
}
393393

394-
@Test
395-
public void testGetProxyAuthenticatedHttps() throws Exception {
396-
httpServer.addSslConnector();
397-
httpServer.setProxyAuthentication("testuser", "testpass");
398-
Authentication auth = new AuthenticationBuilder()
399-
.addUsername("testuser")
400-
.addPassword("testpass")
401-
.build();
402-
proxy = new Proxy(Proxy.TYPE_HTTPS, httpServer.getHost(), httpServer.getHttpsPort(), auth);
403-
newTransporter("http://bad.localhost:1/");
404-
RecordingTransportListener listener = new RecordingTransportListener();
405-
GetTask task = new GetTask(URI.create("repo/file.txt")).setListener(listener);
406-
transporter.get(task);
407-
assertEquals("test", task.getDataString());
408-
assertEquals(0L, listener.dataOffset);
409-
assertEquals(4L, listener.dataLength);
410-
assertEquals(1, listener.startedCount);
411-
assertTrue("Count: " + listener.progressedCount, listener.progressedCount > 0);
412-
assertEquals(task.getDataString(), new String(listener.baos.toByteArray(), StandardCharsets.UTF_8));
413-
}
414-
415394
@Test
416395
public void testGetProxyUnauthenticated() throws Exception {
417396
httpServer.setProxyAuthentication("testuser", "testpass");
@@ -1159,21 +1138,6 @@ public void testProxyAuthScopeNotUsedForServer() throws Exception {
11591138
}
11601139
}
11611140

1162-
@Test
1163-
public void testProxyType() throws Exception {
1164-
httpServer.addSslConnector();
1165-
proxy = new Proxy(Proxy.TYPE_HTTPS, httpServer.getHost(), httpServer.getHttpsPort(), null);
1166-
newTransporter("http://bad.localhost:1/");
1167-
try {
1168-
transporter.get(new GetTask(URI.create("foo/file.txt")));
1169-
} catch (HttpResponseException e) {
1170-
assertEquals(404, e.getStatusCode());
1171-
assertEquals(
1172-
"http://bad.localhost:1/foo/file.txt",
1173-
httpServer.getLogEntries().get(0).path);
1174-
}
1175-
}
1176-
11771141
@Test
11781142
public void testAuthSchemeReuse() throws Exception {
11791143
httpServer.setAuthentication("testuser", "testpass");

0 commit comments

Comments
 (0)