Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,11 @@ private InetAddress getBindAddress(RepositorySystemSession session, RemoteReposi
private static HttpHost toHost(Proxy proxy) {
HttpHost host = null;
if (proxy != null) {
host = new HttpHost(proxy.getHost(), proxy.getPort(), proxy.getType());
// in Maven, the proxy.protocol is used for proxy matching against remote repository protocol; no TLS proxy
// support
// https://github.com/apache/maven/issues/2519
// https://github.com/apache/maven-resolver/issues/745
host = new HttpHost(proxy.getHost(), proxy.getPort());
}
return host;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,27 +391,6 @@ public void testGetProxyAuthenticated() throws Exception {
assertEquals(task.getDataString(), new String(listener.baos.toByteArray(), StandardCharsets.UTF_8));
}

@Test
public void testGetProxyAuthenticatedHttps() throws Exception {
httpServer.addSslConnector();
httpServer.setProxyAuthentication("testuser", "testpass");
Authentication auth = new AuthenticationBuilder()
.addUsername("testuser")
.addPassword("testpass")
.build();
proxy = new Proxy(Proxy.TYPE_HTTPS, httpServer.getHost(), httpServer.getHttpsPort(), auth);
newTransporter("http://bad.localhost:1/");
RecordingTransportListener listener = new RecordingTransportListener();
GetTask task = new GetTask(URI.create("repo/file.txt")).setListener(listener);
transporter.get(task);
assertEquals("test", task.getDataString());
assertEquals(0L, listener.dataOffset);
assertEquals(4L, listener.dataLength);
assertEquals(1, listener.startedCount);
assertTrue("Count: " + listener.progressedCount, listener.progressedCount > 0);
assertEquals(task.getDataString(), new String(listener.baos.toByteArray(), StandardCharsets.UTF_8));
}

@Test
public void testGetProxyUnauthenticated() throws Exception {
httpServer.setProxyAuthentication("testuser", "testpass");
Expand Down Expand Up @@ -1159,21 +1138,6 @@ public void testProxyAuthScopeNotUsedForServer() throws Exception {
}
}

@Test
public void testProxyType() throws Exception {
httpServer.addSslConnector();
proxy = new Proxy(Proxy.TYPE_HTTPS, httpServer.getHost(), httpServer.getHttpsPort(), null);
newTransporter("http://bad.localhost:1/");
try {
transporter.get(new GetTask(URI.create("foo/file.txt")));
} catch (HttpResponseException e) {
assertEquals(404, e.getStatusCode());
assertEquals(
"http://bad.localhost:1/foo/file.txt",
httpServer.getLogEntries().get(0).path);
}
}

@Test
public void testAuthSchemeReuse() throws Exception {
httpServer.setAuthentication("testuser", "testpass");
Expand Down