Mercurial Hosting > luan
diff src/org/eclipse/jetty/http/HttpParser.java @ 1025:cf0367978d8b
remove View.CaseInsensitive
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 02 Nov 2016 23:46:43 -0600 |
parents | 3718afd99988 |
children | 2ea54e6117c3 |
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpParser.java Tue Nov 01 03:46:28 2016 -0600 +++ b/src/org/eclipse/jetty/http/HttpParser.java Wed Nov 02 23:46:43 2016 -0600 @@ -67,7 +67,7 @@ private Buffer _buffer; // The current buffer in use (either _header or _content) private String _cached; private String _tok0; // Saved token: header name, request method or response version - private final View.CaseInsensitive _tok1 = new View.CaseInsensitive(); // Saved token: header value, request URI or response code + private String _tok1; // Saved token: header value, request URI or response code private String _multiLineValue; private int _responseStatus; // If >0 then we are parsing a response private boolean _persistent; @@ -324,7 +324,8 @@ case STATE_STATUS: if (ch == HttpTokens.SPACE) { - _tok1.update(_buffer.markIndex(), _buffer.getIndex() - 1); +// _tok1.update(_buffer.markIndex(), _buffer.getIndex() - 1); + _tok1 = _buffer.peek(_buffer.markIndex(), _buffer.getIndex() - 1 - _buffer.markIndex()).toString(); _state=STATE_SPACE2; continue; } @@ -339,7 +340,8 @@ _state=STATE_HEADER; // _tok0.setPutIndex(_tok0.getIndex()); _tok0 = ""; - _tok1.setPutIndex(_tok1.getIndex()); +// _tok1.setPutIndex(_tok1.getIndex()); + _tok1 = ""; _multiLineValue=null; continue; } @@ -351,14 +353,15 @@ case STATE_URI: if (ch == HttpTokens.SPACE) { - _tok1.update(_buffer.markIndex(), _buffer.getIndex() - 1); +// _tok1.update(_buffer.markIndex(), _buffer.getIndex() - 1); + _tok1 = _buffer.peek(_buffer.markIndex(), _buffer.getIndex() - 1 - _buffer.markIndex()).toString(); _state=STATE_SPACE2; continue; } else if (ch < HttpTokens.SPACE && ch>=0) { // HTTP/0.9 - _handler.startRequest(_tok0, _buffer.sliceFromMark(), null); + _handler.startRequest(_tok0, _buffer.sliceFromMark().toString(), null); _persistent=false; _state=STATE_SEEKING_EOF; _handler.headerComplete(); @@ -381,7 +384,8 @@ _state=STATE_HEADER; // _tok0.setPutIndex(_tok0.getIndex()); _tok0 = ""; - _tok1.setPutIndex(_tok1.getIndex()); +// _tok1.setPutIndex(_tok1.getIndex()); + _tok1 = ""; _multiLineValue=null; } else @@ -411,7 +415,8 @@ _state=STATE_HEADER; // _tok0.setPutIndex(_tok0.getIndex()); _tok0 = ""; - _tok1.setPutIndex(_tok1.getIndex()); +// _tok1.setPutIndex(_tok1.getIndex()); + _tok1 = ""; _multiLineValue=null; continue; } @@ -437,7 +442,7 @@ { String header = _cached!=null ? _cached : _tok0; _cached = null; - String value = _multiLineValue == null ? _tok1.toString() : _multiLineValue; + String value = _multiLineValue == null ? _tok1 : _multiLineValue; int ho = HttpHeaders.CACHE.getOrdinal(header); if (ho >= 0) @@ -513,7 +518,8 @@ _handler.parsedHeader(header, value); // _tok0.setPutIndex(_tok0.getIndex()); _tok0 = ""; - _tok1.setPutIndex(_tok1.getIndex()); +// _tok1.setPutIndex(_tok1.getIndex()); + _tok1 = ""; _multiLineValue=null; } _buffer.setMarkIndex(-1); @@ -680,13 +686,15 @@ if (_length > 0) { if (_tok1.length() == 0) - _tok1.update(_buffer.markIndex(), _buffer.markIndex() + _length); +// _tok1.update(_buffer.markIndex(), _buffer.markIndex() + _length); + _tok1 = _buffer.peek(_buffer.markIndex(), _length).toString(); else { // Continuation line! - if (_multiLineValue == null) _multiLineValue=_tok1.toString(StringUtil.__ISO_8859_1); - _tok1.update(_buffer.markIndex(), _buffer.markIndex() + _length); - _multiLineValue += " " + _tok1.toString(StringUtil.__ISO_8859_1); + if (_multiLineValue == null) _multiLineValue = _tok1; +// _tok1.update(_buffer.markIndex(), _buffer.markIndex() + _length); + _tok1 = _buffer.peek(_buffer.markIndex(), _length).toString(); + _multiLineValue += " " + _tok1; } } _eol=ch; @@ -713,13 +721,15 @@ if (_length > 0) { if (_tok1.length() == 0) - _tok1.update(_buffer.markIndex(), _buffer.markIndex() + _length); +// _tok1.update(_buffer.markIndex(), _buffer.markIndex() + _length); + _tok1 = _buffer.peek(_buffer.markIndex(), _length).toString(); else { // Continuation line! - if (_multiLineValue == null) _multiLineValue=_tok1.toString(StringUtil.__ISO_8859_1); - _tok1.update(_buffer.markIndex(), _buffer.markIndex() + _length); - _multiLineValue += " " + _tok1.toString(StringUtil.__ISO_8859_1); + if (_multiLineValue == null) _multiLineValue = _tok1; +// _tok1.update(_buffer.markIndex(), _buffer.markIndex() + _length); + _tok1 = _buffer.peek(_buffer.markIndex(), _length).toString(); + _multiLineValue += " " + _tok1; } } _eol=ch; @@ -1067,7 +1077,8 @@ // _tok0.update(_header); _tok0 = ""; //System.out.println("qqqqqqqqqqqqqqqq l "+_tok0); - _tok1.update(_header); +// _tok1.update(_header); + _tok1 = ""; } return _header; } @@ -1147,7 +1158,7 @@ /** * This is the method called by parser when the HTTP request line is parsed */ - public abstract void startRequest(String method, Buffer url, String version) + public abstract void startRequest(String method, String url, String version) throws IOException; public void earlyEOF();