Mercurial Hosting > luan
comparison src/org/eclipse/jetty/http/HttpParser.java @ 1037:3c4c7cc7904f
rename Buffer.hasContent() to hasRemaining()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 03 Nov 2016 21:54:34 -0600 |
parents | b87f97f6418a |
children | b71ad168fe34 |
comparison
equal
deleted
inserted
replaced
1036:b87f97f6418a | 1037:3c4c7cc7904f |
---|---|
142 public boolean parseAvailable() throws IOException | 142 public boolean parseAvailable() throws IOException |
143 { | 143 { |
144 boolean progress = parseNext() > 0; | 144 boolean progress = parseNext() > 0; |
145 | 145 |
146 // continue parsing | 146 // continue parsing |
147 while (!isComplete() && _buffer!=null && _buffer.length()>0 && !_contentView.hasContent()) | 147 while (!isComplete() && _buffer!=null && _buffer.length()>0 && !_contentView.hasRemaining()) |
148 { | 148 { |
149 progress |= parseNext()>0; | 149 progress |= parseNext()>0; |
150 } | 150 } |
151 return progress; | 151 return progress; |
152 } | 152 } |
175 _state=STATE_END; | 175 _state=STATE_END; |
176 _handler.messageComplete(_contentPosition); | 176 _handler.messageComplete(_contentPosition); |
177 return 1; | 177 return 1; |
178 } | 178 } |
179 | 179 |
180 int length=_buffer.length(); | 180 int length = _buffer.length(); |
181 | 181 |
182 // Fill buffer if we can | 182 // Fill buffer if we can |
183 if (length == 0) | 183 if (length == 0) |
184 { | 184 { |
185 int filled=-1; | 185 int filled=-1; |
530 _contentLength=HttpTokens.EOF_CONTENT; | 530 _contentLength=HttpTokens.EOF_CONTENT; |
531 } | 531 } |
532 | 532 |
533 _contentPosition=0; | 533 _contentPosition=0; |
534 _eol=ch; | 534 _eol=ch; |
535 if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasContent() && _buffer.peek()==HttpTokens.LINE_FEED) | 535 if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && _buffer.peek()==HttpTokens.LINE_FEED) |
536 _eol=_buffer.get(); | 536 _eol=_buffer.get(); |
537 | 537 |
538 // We convert _contentLength to an int for this switch statement because | 538 // We convert _contentLength to an int for this switch statement because |
539 // we don't care about the amount of data available just whether there is some. | 539 // we don't care about the amount of data available just whether there is some. |
540 switch (_contentLength > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) _contentLength) | 540 switch (_contentLength > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) _contentLength) |
814 { | 814 { |
815 _eol=ch; | 815 _eol=ch; |
816 | 816 |
817 if (_chunkLength == 0) | 817 if (_chunkLength == 0) |
818 { | 818 { |
819 if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasContent() && _buffer.peek()==HttpTokens.LINE_FEED) | 819 if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && _buffer.peek()==HttpTokens.LINE_FEED) |
820 _eol=_buffer.get(); | 820 _eol=_buffer.get(); |
821 _state = _persistent?STATE_END:STATE_SEEKING_EOF; | 821 _state = _persistent?STATE_END:STATE_SEEKING_EOF; |
822 _handler.messageComplete(_contentPosition); | 822 _handler.messageComplete(_contentPosition); |
823 return 1; | 823 return 1; |
824 } | 824 } |
844 if (ch == HttpTokens.CARRIAGE_RETURN || ch == HttpTokens.LINE_FEED) | 844 if (ch == HttpTokens.CARRIAGE_RETURN || ch == HttpTokens.LINE_FEED) |
845 { | 845 { |
846 _eol=ch; | 846 _eol=ch; |
847 if (_chunkLength == 0) | 847 if (_chunkLength == 0) |
848 { | 848 { |
849 if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasContent() && _buffer.peek()==HttpTokens.LINE_FEED) | 849 if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && _buffer.peek()==HttpTokens.LINE_FEED) |
850 _eol=_buffer.get(); | 850 _eol=_buffer.get(); |
851 _state = _persistent?STATE_END:STATE_SEEKING_EOF; | 851 _state = _persistent?STATE_END:STATE_SEEKING_EOF; |
852 _handler.messageComplete(_contentPosition); | 852 _handler.messageComplete(_contentPosition); |
853 return 1; | 853 return 1; |
854 } | 854 } |
924 // Do we have a buffer? | 924 // Do we have a buffer? |
925 if (_buffer==null) | 925 if (_buffer==null) |
926 _buffer = _header; | 926 _buffer = _header; |
927 | 927 |
928 // Is there unconsumed content in body buffer | 928 // Is there unconsumed content in body buffer |
929 if (_state>STATE_END && _buffer==_header && !_header.hasContent() && _body.hasContent()) | 929 if (_state>STATE_END && _buffer==_header && !_header.hasRemaining() && _body.hasRemaining()) |
930 { | 930 { |
931 _buffer = _body; | 931 _buffer = _body; |
932 return _buffer.length(); | 932 return _buffer.length(); |
933 } | 933 } |
934 | 934 |