comparison src/org/eclipse/jetty/http/HttpGenerator.java @ 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
comparison
equal deleted inserted replaced
1066:bbbda7c6e8ec 1067:56b515be91e1
189 // Yes - so we better check we have a buffer 189 // Yes - so we better check we have a buffer
190 if (_buffer == null) 190 if (_buffer == null)
191 _buffer = _buffers.getBuffer(); 191 _buffer = _buffers.getBuffer();
192 192
193 // Copy _content to buffer; 193 // Copy _content to buffer;
194 int len=_buffer.put(_content); 194 int len = _buffer.put(_content);
195 _content.skip(len); 195 _content.skip(len);
196 if (_content.remaining() == 0) 196 if (_content.remaining() == 0)
197 _content = null; 197 _content = null;
198 } 198 }
199 } 199 }
1039 { 1039 {
1040 if (_state != STATE_HEADER) throw new IllegalStateException("STATE!=START"); 1040 if (_state != STATE_HEADER) throw new IllegalStateException("STATE!=START");
1041 _status = status; 1041 _status = status;
1042 if (reason!=null) 1042 if (reason!=null)
1043 { 1043 {
1044 int len=reason.length(); 1044 int len = reason.length();
1045 1045
1046 // TODO don't hard code 1046 // TODO don't hard code
1047 if (len>1024) 1047 if (len>1024)
1048 len=1024; 1048 len=1024;
1049 _reason = BufferUtil.newBuffer(len); 1049 _reason = BufferUtil.newBuffer(len);
1050 _reason.clear();
1050 for (int i=0;i<len;i++) 1051 for (int i=0;i<len;i++)
1051 { 1052 {
1052 char ch = reason.charAt(i); 1053 char ch = reason.charAt(i);
1053 if (ch!='\r'&&ch!='\n') 1054 if (ch!='\r'&&ch!='\n')
1054 _reason.put((byte)ch); 1055 _reason.putQ((byte)ch);
1055 else 1056 else
1056 _reason.put((byte)' '); 1057 _reason.putQ((byte)' ');
1057 } 1058 }
1059 _reason.flip();
1058 } 1060 }
1059 } 1061 }
1060 1062
1061 public final void completeUncheckedAddContent() 1063 public final void completeUncheckedAddContent()
1062 { 1064 {