Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java')
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java
index af5d510d86..025cf68c8a 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java
@@ -24,12 +24,13 @@ import javax.servlet.ServletInputStream;
import org.eclipse.jetty.http.HttpParser;
import org.eclipse.jetty.io.Buffer;
+import org.eclipse.jetty.io.EofException;
public class HttpInput extends ServletInputStream
{
protected final AbstractHttpConnection _connection;
protected final HttpParser _parser;
-
+
/* ------------------------------------------------------------ */
public HttpInput(AbstractHttpConnection connection)
{
@@ -44,11 +45,9 @@ public class HttpInput extends ServletInputStream
@Override
public int read() throws IOException
{
- int c=-1;
- Buffer content=_parser.blockForContent(_connection.getMaxIdleTime());
- if (content!=null)
- c= 0xff & content.get();
- return c;
+ byte[] bytes = new byte[1];
+ int read = read(bytes, 0, 1);
+ return read < 0 ? -1 : 0xff & bytes[0];
}
/* ------------------------------------------------------------ */
@@ -62,6 +61,8 @@ public class HttpInput extends ServletInputStream
Buffer content=_parser.blockForContent(_connection.getMaxIdleTime());
if (content!=null)
l= content.get(b, off, len);
+ else if (_connection.isEarlyEOF())
+ throw new EofException("early EOF");
return l;
}
@@ -71,8 +72,4 @@ public class HttpInput extends ServletInputStream
{
return _parser.available();
}
-
-
-
-
}

Back to the top