diff src/org/eclipse/jetty/http/HttpParser.java @ 1052:4a2489f1d5fe

remove JBuffer.peek()
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 08 Nov 2016 00:27:16 -0700
parents 1ab2dd0a7db5
children 7e4b41247544
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpParser.java	Tue Nov 08 00:18:45 2016 -0700
+++ b/src/org/eclipse/jetty/http/HttpParser.java	Tue Nov 08 00:27:16 2016 -0700
@@ -122,6 +122,10 @@
 		return dup;
 	}
 
+	public byte peek() {
+		return _buffer.get(_buffer.position());
+	}
+
 
 	public long getContentLength()
 	{
@@ -571,7 +575,7 @@
 
 									_contentPosition=0;
 									_eol=ch;
-									if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && _buffer.peek()==HttpTokens.LINE_FEED)
+									if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && peek()==HttpTokens.LINE_FEED)
 										_eol=_buffer.get();
 
 									// We convert _contentLength to an int for this switch statement because
@@ -781,7 +785,7 @@
 					last=_state;
 				}
 
-				if (_eol == HttpTokens.CARRIAGE_RETURN && _buffer.peek() == HttpTokens.LINE_FEED)
+				if (_eol == HttpTokens.CARRIAGE_RETURN && peek() == HttpTokens.LINE_FEED)
 				{
 					_eol=_buffer.get();
 					length=_buffer.remaining();
@@ -833,7 +837,7 @@
 
 					case STATE_CHUNKED_CONTENT:
 					{
-						ch=_buffer.peek();
+						ch=peek();
 						if (ch == HttpTokens.CARRIAGE_RETURN || ch == HttpTokens.LINE_FEED)
 							_eol=_buffer.get();
 						else if (ch <= HttpTokens.SPACE)
@@ -856,7 +860,7 @@
 
 							if (_chunkLength == 0)
 							{
-								if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && _buffer.peek()==HttpTokens.LINE_FEED)
+								if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && peek()==HttpTokens.LINE_FEED)
 									_eol=_buffer.get();
 								_state = _persistent?STATE_END:STATE_SEEKING_EOF;
 								_handler.messageComplete(_contentPosition);
@@ -886,7 +890,7 @@
 							_eol=ch;
 							if (_chunkLength == 0)
 							{
-								if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && _buffer.peek()==HttpTokens.LINE_FEED)
+								if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && peek()==HttpTokens.LINE_FEED)
 									_eol=_buffer.get();
 								_state = _persistent?STATE_END:STATE_SEEKING_EOF;
 								_handler.messageComplete(_contentPosition);