changeset 1067:56b515be91e1

fix use of HttpGenerator._reason
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 10 Nov 2016 00:08:39 -0700
parents bbbda7c6e8ec
children 9d357b9e4bcb
files src/org/eclipse/jetty/http/HttpGenerator.java
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpGenerator.java	Wed Nov 09 05:48:10 2016 -0700
+++ b/src/org/eclipse/jetty/http/HttpGenerator.java	Thu Nov 10 00:08:39 2016 -0700
@@ -191,7 +191,7 @@
 				_buffer = _buffers.getBuffer();
 
 			// Copy _content to buffer;
-			int len=_buffer.put(_content);
+			int len = _buffer.put(_content);
 			_content.skip(len);
 			if (_content.remaining() == 0)
 				_content = null;
@@ -1041,20 +1041,22 @@
 		_status = status;
 		if (reason!=null)
 		{
-			int len=reason.length();
+			int len = reason.length();
 
 			// TODO don't hard code
 			if (len>1024)
 				len=1024;
 			_reason = BufferUtil.newBuffer(len);
+			_reason.clear();
 			for (int i=0;i<len;i++)
 			{
 				char ch = reason.charAt(i);
 				if (ch!='\r'&&ch!='\n')
-					_reason.put((byte)ch);
+					_reason.putQ((byte)ch);
 				else
-					_reason.put((byte)' ');
+					_reason.putQ((byte)' ');
 			}
+			_reason.flip();
 		}
 	}