Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2011-11-02 13:04:49 +0000
committerSimone Bordet2011-11-04 09:20:52 +0000
commitf01877e7388051eb59b7f83da9cacceb2e806a5a (patch)
tree8eb4550a70441d290187233cdef92c0466bdcb6e /jetty-client/src/main/java/org/eclipse/jetty
parent5ca9dbb7d44f392524e994586b87ecd46f0c9acc (diff)
downloadorg.eclipse.jetty.project-f01877e7388051eb59b7f83da9cacceb2e806a5a.tar.gz
org.eclipse.jetty.project-f01877e7388051eb59b7f83da9cacceb2e806a5a.tar.xz
org.eclipse.jetty.project-f01877e7388051eb59b7f83da9cacceb2e806a5a.zip
360665: Fixed an endless loop on https proxy requests + added tests
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Diffstat (limited to 'jetty-client/src/main/java/org/eclipse/jetty')
-rw-r--r--jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java31
1 files changed, 26 insertions, 5 deletions
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
index 9d7723b2b1..c5dcbbe22f 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
@@ -65,7 +65,7 @@ public class HttpDestination implements Dumpable
private List<HttpCookie> _cookies;
-
+
HttpDestination(HttpClient client, Address address, boolean ssl)
{
_client = client;
@@ -524,7 +524,7 @@ public class HttpDestination implements Dumpable
// Add any known authorizations
if (_authorizations != null)
{
- Authentication auth = (Authentication)_authorizations.match(ex.getURI());
+ Authentication auth = (Authentication)_authorizations.match(ex.getRequestURI());
if (auth != null)
(auth).setCredentials(ex);
}
@@ -665,7 +665,7 @@ public class HttpDestination implements Dumpable
AggregateLifeCycle.dump(out,indent,_connections);
}
}
-
+
private class ConnectExchange extends ContentExchange
{
private final SelectConnector.ProxySelectChannelEndPoint proxyEndPoint;
@@ -687,13 +687,17 @@ public class HttpDestination implements Dumpable
@Override
protected void onResponseComplete() throws IOException
{
- if (getResponseStatus() == HttpStatus.OK_200)
+ int responseStatus = getResponseStatus();
+ if (responseStatus == HttpStatus.OK_200)
{
proxyEndPoint.upgrade();
}
+ else if(responseStatus == HttpStatus.GATEWAY_TIMEOUT_504){
+ onExpire();
+ }
else
{
- onConnectionFailed(new ConnectException(exchange.getAddress().toString()));
+ onException(new ConnectException("Proxy: " + proxyEndPoint.getRemoteAddr() +":" + proxyEndPoint.getRemotePort() + " didn't return http return code 200, but " + responseStatus + " while trying to request: " + exchange.getAddress().toString()));
}
}
@@ -702,5 +706,22 @@ public class HttpDestination implements Dumpable
{
HttpDestination.this.onConnectionFailed(x);
}
+
+ @Override
+ protected void onException(Throwable x)
+ {
+ _queue.remove(exchange);
+ exchange.setStatus(STATUS_EXCEPTED);
+ exchange.getEventListener().onException(x);
+ }
+
+ @Override
+ protected void onExpire()
+ {
+ _queue.remove(exchange);
+ exchange.setStatus(STATUS_EXPIRED);
+ exchange.getEventListener().onExpire();
+ }
+
}
}

Back to the top