From a51b1a217c30a866eacc91142492d7d202cccee2 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Thu, 15 Apr 2010 09:44:16 +0000 Subject: [PATCH] Improvements for #297104. git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1516 7e9141cc-0065-0410-87d8-b60c137991c4 --- .../jetty/server/handler/ProxyHandler.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ProxyHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ProxyHandler.java index 490f00419bd..f63d5f0118c 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ProxyHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ProxyHandler.java @@ -334,6 +334,19 @@ public class ProxyHandler extends AbstractHandler proxyToServer.waitReady(_connectTimeout); } + /** + *

Reads (with non-blocking semantic) into the given {@code buffer} from the given {@code endPoint}.

+ * @param endPoint the endPoint to read from + * @param buffer the buffer to read data into + * @return the number of bytes read (possibly 0 since the read is non-blocking) + * or -1 if the channel has been closed remotely + * @throws IOException if the endPoint cannot be read + */ + protected int read(EndPoint endPoint, Buffer buffer) throws IOException + { + return endPoint.fill(buffer); + } + /** *

Writes (with blocking semantic) the given buffer of data onto the given endPoint.

* @@ -451,7 +464,7 @@ public class ProxyHandler extends AbstractHandler while (true) { - int read = _endPoint.fill(_buffer); + int read = read(_endPoint, _buffer); if (read == -1) { @@ -551,7 +564,7 @@ public class ProxyHandler extends AbstractHandler while (true) { - int read = _endPoint.fill(_buffer); + int read = read(_endPoint, _buffer); if (read == -1) {