Mercurial Hosting > luan
comparison 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 |
comparison
equal
deleted
inserted
replaced
1059:013939bfc9e8 | 1060:957f758dcffc |
---|---|
877 * @see java.io.InputStream#read(byte[], int, int) | 877 * @see java.io.InputStream#read(byte[], int, int) |
878 */ | 878 */ |
879 @Override | 879 @Override |
880 public int read(byte[] b, int off, int len) throws IOException | 880 public int read(byte[] b, int off, int len) throws IOException |
881 { | 881 { |
882 int l = -1; | |
883 JBuffer content = _parser.blockForContent(getMaxIdleTime()); | 882 JBuffer content = _parser.blockForContent(getMaxIdleTime()); |
884 if (content!=null) | 883 if (content!=null) { |
885 l = content.get(b, off, len); | 884 int remaining = content.remaining(); |
886 else if (_earlyEOF) | 885 if( remaining == 0 ) |
886 return -1; | |
887 if( len > remaining ) | |
888 len = remaining; | |
889 content.get(b, off, len); | |
890 return len; | |
891 } else if (_earlyEOF) | |
887 throw new EofException("early EOF"); | 892 throw new EofException("early EOF"); |
888 return l; | 893 else |
894 return -1; | |
889 } | 895 } |
890 | 896 |
891 @Override | 897 @Override |
892 public int available() throws IOException | 898 public int available() throws IOException |
893 { | 899 { |