public CachedHttpField(HttpHeader header,String value) { super(header,value); int cbl=header.getBytesColonSpace().length; _bytes=Arrays.copyOf(header.getBytesColonSpace(), cbl+value.length()+2); System.arraycopy(value.getBytes(StandardCharsets.ISO_8859_1),0,_bytes,cbl,value.length()); _bytes[_bytes.length-2]=(byte)'\r'; _bytes[_bytes.length-1]=(byte)'\n'; }
private static void putContentLength(ByteBuffer header,long contentLength) { if (contentLength==0) header.put(CONTENT_LENGTH_0); else { header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, contentLength); header.put(HttpTokens.CRLF); } }
private static void putContentLength(ByteBuffer header,long contentLength) { if (contentLength==0) header.put(CONTENT_LENGTH_0); else { header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, contentLength); header.put(HttpTokens.CRLF); } }
/** * @see org.eclipse.jetty.http.HttpFieldPreEncoder#getEncodedField(org.eclipse.jetty.http.HttpHeader, java.lang.String, java.lang.String) */ @Override public byte[] getEncodedField(HttpHeader header, String headerString, String value) { if (header!=null) { int cbl=header.getBytesColonSpace().length; byte[] bytes=Arrays.copyOf(header.getBytesColonSpace(), cbl+value.length()+2); System.arraycopy(value.getBytes(ISO_8859_1),0,bytes,cbl,value.length()); bytes[bytes.length-2]=(byte)'\r'; bytes[bytes.length-1]=(byte)'\n'; return bytes; } byte[] n=headerString.getBytes(ISO_8859_1); byte[] v=value.getBytes(ISO_8859_1); byte[] bytes=Arrays.copyOf(n,n.length+2+v.length+2); bytes[n.length]=(byte)':'; bytes[n.length]=(byte)' '; bytes[bytes.length-2]=(byte)'\r'; bytes[bytes.length-1]=(byte)'\n'; return bytes; } }
/** * @see org.eclipse.jetty.http.HttpFieldPreEncoder#getEncodedField(org.eclipse.jetty.http.HttpHeader, java.lang.String, java.lang.String) */ @Override public byte[] getEncodedField(HttpHeader header, String headerString, String value) { if (header!=null) { int cbl=header.getBytesColonSpace().length; byte[] bytes=Arrays.copyOf(header.getBytesColonSpace(), cbl+value.length()+2); System.arraycopy(value.getBytes(ISO_8859_1),0,bytes,cbl,value.length()); bytes[bytes.length-2]=(byte)'\r'; bytes[bytes.length-1]=(byte)'\n'; return bytes; } byte[] n=headerString.getBytes(ISO_8859_1); byte[] v=value.getBytes(ISO_8859_1); byte[] bytes=Arrays.copyOf(n,n.length+2+v.length+2); bytes[n.length]=(byte)':'; bytes[n.length]=(byte)' '; bytes[bytes.length-2]=(byte)'\r'; bytes[bytes.length-1]=(byte)'\n'; return bytes; } }
/** * @see org.eclipse.jetty.http.HttpFieldPreEncoder#getEncodedField(org.eclipse.jetty.http.HttpHeader, java.lang.String, java.lang.String) */ @Override public byte[] getEncodedField(HttpHeader header, String headerString, String value) { if (header!=null) { int cbl=header.getBytesColonSpace().length; byte[] bytes=Arrays.copyOf(header.getBytesColonSpace(), cbl+value.length()+2); System.arraycopy(value.getBytes(ISO_8859_1),0,bytes,cbl,value.length()); bytes[bytes.length-2]=(byte)'\r'; bytes[bytes.length-1]=(byte)'\n'; return bytes; } byte[] n=headerString.getBytes(ISO_8859_1); byte[] v=value.getBytes(ISO_8859_1); byte[] bytes=Arrays.copyOf(n,n.length+2+v.length+2); bytes[n.length]=(byte)':'; bytes[n.length]=(byte)' '; bytes[bytes.length-2]=(byte)'\r'; bytes[bytes.length-1]=(byte)'\n'; return bytes; } }
public CachedHttpField(HttpHeader header, String value) { super(header,value); _bytes=new byte[header.asString().length()+2+value.length()+2]; System.arraycopy(header.getBytesColonSpace(),0,_bytes,0,header.asString().length()+2); System.arraycopy(toSanitisedValue(value),0,_bytes,header.asString().length()+2,value.length()); _bytes[_bytes.length-2]='\r'; _bytes[_bytes.length-1]='\n'; }
public CachedHttpField(HttpHeader header, String value) { super(header,value); _bytes=new byte[header.asString().length()+2+value.length()+2]; System.arraycopy(header.getBytesColonSpace(),0,_bytes,0,header.asString().length()+2); System.arraycopy(toSanitisedValue(value),0,_bytes,header.asString().length()+2,value.length()); _bytes[_bytes.length-2]='\r'; _bytes[_bytes.length-1]='\n'; }
private void putContentLength(ByteBuffer header, long contentLength, boolean contentType, MetaData.Request request, MetaData.Response response) { if (contentLength>0) { header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, contentLength); header.put(HttpTokens.CRLF); } else if (!_noContent) { if (contentType || response!=null || (request!=null && __assumedContentMethods.contains(request.getMethod()))) header.put(CONTENT_LENGTH_0); } }
public void putTo(ByteBuffer bufferInFillMode) { if (_header!=null) { bufferInFillMode.put(_header.getBytesColonSpace()); bufferInFillMode.put(toSanitisedValue(_value)); } else { bufferInFillMode.put(toSanitisedName(_name)); bufferInFillMode.put(__colon_space); bufferInFillMode.put(toSanitisedValue(_value)); } BufferUtil.putCRLF(bufferInFillMode); }
public void putTo(ByteBuffer bufferInFillMode) { if (_header!=null) { bufferInFillMode.put(_header.getBytesColonSpace()); bufferInFillMode.put(toSanitisedValue(_value)); } else { bufferInFillMode.put(toSanitisedName(_name)); bufferInFillMode.put(__colon_space); bufferInFillMode.put(toSanitisedValue(_value)); } BufferUtil.putCRLF(bufferInFillMode); }
public static void putTo(HttpField field, ByteBuffer bufferInFillMode) { if (field instanceof PreEncodedHttpField) { ((PreEncodedHttpField)field).putTo(bufferInFillMode,HttpVersion.HTTP_1_0); } else { HttpHeader header=field.getHeader(); if (header!=null) { bufferInFillMode.put(header.getBytesColonSpace()); putSanitisedValue(field.getValue(),bufferInFillMode); } else { putSanitisedName(field.getName(),bufferInFillMode); bufferInFillMode.put(__colon_space); putSanitisedValue(field.getValue(),bufferInFillMode); } BufferUtil.putCRLF(bufferInFillMode); } }
public static void putTo(HttpField field, ByteBuffer bufferInFillMode) { if (field instanceof PreEncodedHttpField) { ((PreEncodedHttpField)field).putTo(bufferInFillMode,HttpVersion.HTTP_1_0); } else { HttpHeader header=field.getHeader(); if (header!=null) { bufferInFillMode.put(header.getBytesColonSpace()); putSanitisedValue(field.getValue(),bufferInFillMode); } else { putSanitisedName(field.getName(),bufferInFillMode); bufferInFillMode.put(__colon_space); putSanitisedValue(field.getValue(),bufferInFillMode); } BufferUtil.putCRLF(bufferInFillMode); } }
public static void putTo(HttpField field, ByteBuffer bufferInFillMode) { if (field instanceof CachedHttpField) { ((CachedHttpField)field).putTo(bufferInFillMode); } else { HttpHeader header=field.getHeader(); if (header!=null) { bufferInFillMode.put(header.getBytesColonSpace()); putSanitisedValue(field.getValue(),bufferInFillMode); } else { putSanitisedName(field.getName(),bufferInFillMode); bufferInFillMode.put(__colon_space); putSanitisedValue(field.getValue(),bufferInFillMode); } BufferUtil.putCRLF(bufferInFillMode); } }
public static void putTo(HttpField field, ByteBuffer bufferInFillMode) { if (field instanceof PreEncodedHttpField) { ((PreEncodedHttpField)field).putTo(bufferInFillMode,HttpVersion.HTTP_1_0); } else { HttpHeader header=field.getHeader(); if (header!=null) { bufferInFillMode.put(header.getBytesColonSpace()); putSanitisedValue(field.getValue(),bufferInFillMode); } else { putSanitisedName(field.getName(),bufferInFillMode); bufferInFillMode.put(__colon_space); putSanitisedValue(field.getValue(),bufferInFillMode); } BufferUtil.putCRLF(bufferInFillMode); } }
header.put(HttpHeader.CONNECTION.getBytesColonSpace()).put(HttpHeader.UPGRADE.getBytes()); header.put(CRLF); break; header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, content_length); header.put(HttpTokens.CRLF); header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, content_length); header.put(HttpTokens.CRLF); header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, content_length); header.put(HttpTokens.CRLF);
header.put(HttpHeader.CONNECTION.getBytesColonSpace()).put(HttpHeader.UPGRADE.getBytes()); header.put(CRLF); break; header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, content_length); header.put(HttpTokens.CRLF); header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, content_length); header.put(HttpTokens.CRLF); header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, content_length); header.put(HttpTokens.CRLF);
header.put(HttpHeader.CONNECTION.getBytesColonSpace()).put(HttpHeader.UPGRADE.getBytes()); header.put(CRLF); break; header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, content_length); header.put(HttpTokens.CRLF); header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, content_length); header.put(HttpTokens.CRLF); if (content_length>0) header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, content_length); header.put(HttpTokens.CRLF); header.put(HttpHeader.CONNECTION.getBytesColonSpace()); header.put(StringUtil.getBytes(connection.toString())); header.put(CRLF);
header.put(HttpHeader.CONNECTION.getBytesColonSpace()).put(HttpHeader.UPGRADE.getBytes()); header.put(CRLF); break; header.put(HttpHeader.CONTENT_LENGTH.getBytesColonSpace()); BufferUtil.putDecLong(header, content_length); header.put(HttpTokens.CRLF); header.put(HttpHeader.CONNECTION.getBytesColonSpace()); header.put(StringUtil.getBytes(connection.toString())); header.put(CRLF);