Mercurial Hosting > luan
changeset 1069:7dd6ec499000
fix use of HttpGenerator._content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 10 Nov 2016 00:42:51 -0700 |
parents | 9d357b9e4bcb |
children | a44fc6b53757 |
files | src/org/eclipse/jetty/http/HttpGenerator.java |
diffstat | 1 files changed, 17 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
diff -r 9d357b9e4bcb -r 7dd6ec499000 src/org/eclipse/jetty/http/HttpGenerator.java --- a/src/org/eclipse/jetty/http/HttpGenerator.java Thu Nov 10 00:23:05 2016 -0700 +++ b/src/org/eclipse/jetty/http/HttpGenerator.java Thu Nov 10 00:42:51 2016 -0700 @@ -140,12 +140,12 @@ _last = last; // Handle any unfinished business? - if (_content!=null && _content.remaining()>0 || _bufferChunked) + if (_content!=null && _content.hasRemaining() || _bufferChunked) { if (_endp.isOutputShutdown()) throw new EofException(); flushBuffer(); - if (_content != null && _content.remaining()>0) + if (_content != null && _content.hasRemaining()) { if (_bufferChunked) { @@ -178,16 +178,17 @@ // content.clear(); _content = null; } - else if ((_buffer==null || _buffer.remaining()==0) && _content.remaining() > 0 && (_last || isCommitted() && _content.remaining()>1024)) + else if ((_buffer==null || _buffer.remaining()==0) && _content.hasRemaining() && (_last || isCommitted() && _content.remaining()>1024)) { _bypass = true; } else if (!_bufferChunked) { +//System.out.println("qqqqqqqqqqqqqqqqqqq c"); // Copy _content to buffer; int len = _buffer.put(_content); _content.skip(len); - if (_content.remaining() == 0) + if (!_content.hasRemaining()) _content = null; } } @@ -209,10 +210,10 @@ throw new RuntimeException("_last"); // Handle any unfinished business? - if (_content != null && _content.remaining()>0 || _bufferChunked) + if (_content != null && _content.hasRemaining() || _bufferChunked) { flushBuffer(); - if (_content != null && _content.remaining()>0 || _bufferChunked) + if (_content != null && _content.hasRemaining() || _bufferChunked) throw new IllegalStateException("FULL"); } @@ -332,7 +333,7 @@ if (_status<200 && _status>=100 ) { _noContent = true; - _content=null; + _content = null; if (_buffer!=null) _buffer.clearJ(); // end the header. @@ -347,7 +348,7 @@ else if (_status==204 || _status==304) { _noContent = true; - _content=null; + _content = null; if (_buffer!=null) _buffer.clearJ(); } @@ -710,14 +711,13 @@ if (_content != null && _content.remaining() < _buffer.space() && _state != STATE_FLUSHING) { _buffer.put(_content); - _content.clearJ(); - _content=null; + _content = null; } } } // Are we completely finished for now? - if (!_needCRLF && !_needEOC && (_content==null || _content.remaining()==0)) + if (!_needCRLF && !_needEOC && (_content==null || !_content.hasRemaining())) { if (_state == STATE_FLUSHING) _state = STATE_END; @@ -753,7 +753,7 @@ { return ((_header.position() > 0)?4:0) | ((_buffer != null && _buffer.remaining() > 0)?2:0) - | ((_bypass && _content != null && _content.remaining() > 0)?1:0); + | ((_bypass && _content != null && _content.hasRemaining())?1:0); } private void prepareBuffers() @@ -762,11 +762,11 @@ if (!_bufferChunked) { // Refill buffer if possible - if (!_bypass && _content != null && _content.remaining() > 0 && _buffer != null && _buffer.space() > 0) + if (!_bypass && _content != null && _content.hasRemaining() && _buffer != null && _buffer.space() > 0) { int len = _buffer.put(_content); _content.skip(len); - if (_content.remaining() == 0) + if (!_content.hasRemaining()) _content = null; } @@ -819,7 +819,7 @@ } // If we need EOC and everything written - if (_needEOC && (_content == null || _content.remaining() == 0)) + if (_needEOC && (_content == null || !_content.hasRemaining())) { if (_needCRLF) { @@ -860,7 +860,7 @@ } } - if (_content != null && _content.remaining() == 0) + if (_content != null && !_content.hasRemaining()) _content = null; } @@ -870,7 +870,7 @@ { JBuffer header = _header; JBuffer buffer=_buffer; - JBuffer content=_content; + JBuffer content = _content; return String.format("%s{s=%d,h=%d,b=%d,c=%d}", getClass().getSimpleName(), _state,