Mercurial Hosting > luan
diff src/org/eclipse/jetty/server/AbstractHttpConnection.java @ 1060:957f758dcffc
fix JBuffer.get()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 08 Nov 2016 05:51:00 -0700 |
parents | 013939bfc9e8 |
children | a0abb16cf6e7 |
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/AbstractHttpConnection.java Tue Nov 08 05:39:33 2016 -0700 +++ b/src/org/eclipse/jetty/server/AbstractHttpConnection.java Tue Nov 08 05:51:00 2016 -0700 @@ -879,13 +879,19 @@ @Override public int read(byte[] b, int off, int len) throws IOException { - int l = -1; JBuffer content = _parser.blockForContent(getMaxIdleTime()); - if (content!=null) - l = content.get(b, off, len); - else if (_earlyEOF) + if (content!=null) { + int remaining = content.remaining(); + if( remaining == 0 ) + return -1; + if( len > remaining ) + len = remaining; + content.get(b, off, len); + return len; + } else if (_earlyEOF) throw new EofException("early EOF"); - return l; + else + return -1; } @Override