diff src/org/eclipse/jetty/http/HttpGenerator.java @ 1065:158d1e6ac17f

fix JBuffer.compact()
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 09 Nov 2016 04:36:05 -0700
parents a0abb16cf6e7
children bbbda7c6e8ec
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpGenerator.java	Wed Nov 09 03:09:37 2016 -0700
+++ b/src/org/eclipse/jetty/http/HttpGenerator.java	Wed Nov 09 04:36:05 2016 -0700
@@ -134,7 +134,7 @@
 		if (_last || _state==STATE_END)
 		{
 			LOG.warn("Ignoring extra content {}",content);
-			content.clear();
+//			content.clear();
 			return;
 		}
 		_last = last;
@@ -173,8 +173,8 @@
 		// Handle the _content
 		if (_head)
 		{
-			content.clear();
-			_content=null;
+//			content.clear();
+			_content = null;
 		}
 		else if ((_buffer==null || _buffer.remaining()==0) && _content.remaining() > 0 && (_last || isCommitted() && _content.remaining()>1024))
 		{
@@ -343,7 +343,7 @@
 					_noContent = true;
 					_content=null;
 					if (_buffer!=null)
-						_buffer.clear();
+						_buffer.clearJ();
 					// end the header.
 
 					if (_status!=101 )
@@ -358,7 +358,7 @@
 					_noContent = true;
 					_content=null;
 					if (_buffer!=null)
-						_buffer.clear();
+						_buffer.clearJ();
 				}
 			}
 
@@ -698,14 +698,14 @@
 						len=0;
 						// Nothing more we can write now.
 						if (_header != null)
-							_header.clear();
+							_header.clearJ();
 
 						_bypass = false;
 						_bufferChunked = false;
 
 						if (_buffer != null)
 						{
-							_buffer.clear();
+							_buffer.clearJ();
 							if (_contentLength == HttpTokens.CHUNKED_CONTENT)
 							{
 								// Special case handling for small left over buffer from
@@ -713,7 +713,7 @@
 								if (_content != null && _content.remaining() < _buffer.space() && _state != STATE_FLUSHING)
 								{
 									_buffer.put(_content);
-									_content.clear();
+									_content.clearJ();
 									_content=null;
 								}
 							}
@@ -958,7 +958,7 @@
 		_contentLength = HttpTokens.UNKNOWN_CONTENT;
 		_content = null;
 		if (_buffer!=null)
-			_buffer.clear();
+			_buffer.clearJ();
 	}
 
 	/* ------------------------------------------------------------ */
@@ -1066,7 +1066,7 @@
 	{
 		_contentWritten += _buffer.remaining();
 		if (_head)
-			_buffer.clear();
+			_buffer.clearJ();
 	}
 
 	private boolean isBufferFull2()
@@ -1074,7 +1074,7 @@
 		if (_buffer != null && _buffer.space()==0)
 		{
 			if (_buffer.remaining()==0)
-				_buffer.compact();
+				_buffer.limit(0);
 			return _buffer.space()==0;
 		}