private final static byte[] CONTENT_LENGTH = "\r\nContent-Length: ".getBytes();
private final static byte[] CONTENT_CHUNKED = "\r\nTransfer-Encoding: chunked".getBytes();
public static void finishWritingHeader(byte[] hostBack, int hostPos, int hostLen, int hostMask,
DataOutputBlobWriter<NetPayloadSchema> writer, CharSequence implementationVersion, long length) {
DataOutputBlobWriter.write(writer, REV11_AND_HOST, 0, REV11_AND_HOST.length); //encodeAsUTF8(writer," HTTP/1.1\r\nHost: ");
<BUG>DataOutputBlobWriter.write(writer,hostBack,hostPos,hostLen,hostMask);

if (length>0) {</BUG>
DataOutputBlobWriter.write(writer, CONTENT_LENGTH, 0, CONTENT_LENGTH.length);
<BUG>Appendables.appendValue(writer, length); //does the same as below...
} else if (length<0) {</BUG>
DataOutputBlobWriter.write(writer, CONTENT_CHUNKED, 0, CONTENT_CHUNKED.length);

private final static byte[] CONTENT_LENGTH = "\r\nContent-Length: ".getBytes();
private final static byte[] CONTENT_CHUNKED = "\r\nTransfer-Encoding: chunked".getBytes();
public static void finishWritingHeader(byte[] hostBack, int hostPos, int hostLen, int hostMask,
DataOutputBlobWriter<NetPayloadSchema> writer, CharSequence implementationVersion, long length) {
DataOutputBlobWriter.write(writer, REV11_AND_HOST, 0, REV11_AND_HOST.length); //encodeAsUTF8(writer," HTTP/1.1\r\nHost: ");
DataOutputBlobWriter.write(writer, hostBack, hostPos, hostLen, hostMask);
boolean reportAgent = false;
if (reportAgent) {
DataOutputBlobWriter.write(writer, LINE_AND_USER_AGENT, 0, LINE_AND_USER_AGENT.length, Integer.MAX_VALUE);//DataOutputBlobWriter.encodeAsUTF8(writer,"\r\nUser-Agent: Pronghorn/");
DataOutputBlobWriter.encodeAsUTF8(writer,implementationVersion);
