CRLF -> CR + LF

This commit is contained in:
Trustin Lee 2010-02-01 08:32:18 +00:00
parent bb0c1e139f
commit 7e3358f0f3
3 changed files with 12 additions and 6 deletions

View File

@ -73,7 +73,8 @@ public abstract class HttpMessageEncoder extends OneToOneEncoder {
channel.getConfig().getBufferFactory());
encodeInitialLine(header, m);
encodeHeaders(header, m);
header.writeBytes(CRLF);
header.writeByte(CR);
header.writeByte(LF);
ChannelBuffer content = m.getContent();
if (!content.readable()) {
@ -96,9 +97,11 @@ public abstract class HttpMessageEncoder extends OneToOneEncoder {
ChannelBuffer trailer = ChannelBuffers.dynamicBuffer(
channel.getConfig().getBufferFactory());
trailer.writeByte((byte) '0');
trailer.writeBytes(CRLF);
trailer.writeByte(CR);
trailer.writeByte(LF);
encodeTrailingHeaders(trailer, (HttpChunkTrailer) chunk);
trailer.writeBytes(CRLF);
trailer.writeByte(CR);
trailer.writeByte(LF);
return trailer;
} else {
return LAST_CHUNK.duplicate();
@ -155,7 +158,8 @@ public abstract class HttpMessageEncoder extends OneToOneEncoder {
buf.writeByte(COLON);
buf.writeByte(SP);
buf.writeBytes(value.getBytes("ASCII"));
buf.writeBytes(CRLF);
buf.writeByte(CR);
buf.writeByte(LF);
}
protected abstract void encodeInitialLine(ChannelBuffer buf, HttpMessage message) throws Exception;

View File

@ -45,6 +45,7 @@ public class HttpRequestEncoder extends HttpMessageEncoder {
buf.writeBytes(request.getUri().getBytes("ASCII"));
buf.writeByte(SP);
buf.writeBytes(request.getProtocolVersion().toString().getBytes("ASCII"));
buf.writeBytes(CRLF);
buf.writeByte(CR);
buf.writeByte(LF);
}
}

View File

@ -45,6 +45,7 @@ public class HttpResponseEncoder extends HttpMessageEncoder {
buf.writeBytes(String.valueOf(response.getStatus().getCode()).getBytes("ASCII"));
buf.writeByte(SP);
buf.writeBytes(String.valueOf(response.getStatus().getReasonPhrase()).getBytes("ASCII"));
buf.writeBytes(CRLF);
buf.writeByte(CR);
buf.writeByte(LF);
}
}