diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListenerWrapper.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListenerWrapper.java index 97e1a8d91f9..80f6d5298d9 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListenerWrapper.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpEventListenerWrapper.java @@ -23,6 +23,10 @@ public class HttpEventListenerWrapper implements HttpEventListener HttpEventListener _listener; boolean _delegatingRequests; boolean _delegatingResponses; + boolean _delegationResult; + private Buffer _version; + private int _status; + private Buffer _reason; public HttpEventListenerWrapper() { @@ -68,6 +72,11 @@ public class HttpEventListenerWrapper implements HttpEventListener _delegatingResponses = delegating; } + public void setDelegationResult( boolean result ) + { + _delegationResult = result; + } + public void onConnectionFailed(Throwable ex) { if (_delegatingRequests) @@ -101,7 +110,13 @@ public class HttpEventListenerWrapper implements HttpEventListener public void onResponseComplete() throws IOException { if (_delegatingResponses) + { + if (_delegationResult == false) + { + _listener.onResponseStatus(_version,_status,_reason); + } _listener.onResponseComplete(); + } } public void onResponseContent(Buffer content) throws IOException @@ -125,7 +140,15 @@ public class HttpEventListenerWrapper implements HttpEventListener public void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException { if (_delegatingResponses) + { _listener.onResponseStatus(version,status,reason); + } + else + { + _version = version; + _status = status; + _reason = reason; + } } public void onRetry() diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavListener.java b/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavListener.java index 94996201584..5f94c0dceed 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavListener.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/webdav/WebdavListener.java @@ -120,6 +120,7 @@ public class WebdavListener extends HttpEventListenerWrapper else { // admit defeat but retry because someone else might have + setDelegationResult(false); setDelegatingRequests( true ); setDelegatingResponses(true); super.onResponseComplete();