public HTTPServerConfigImpl(int bindPort, PipeConfigManager pcmIn, PipeConfigManager pcmOut, StructRegistry recordTypeData) { this.bindPort = bindPort; if (bindPort<=0 || (bindPort>=(1<<16))) { throw new UnsupportedOperationException("invalid port "+bindPort); } this.pcmIn = pcmIn; this.pcmOut = pcmOut; //NOTE: this is set at the minimum sizes to support example, template and favicon.ico files this.pcmOut.ensureSize(ServerResponseSchema.class, 4, Math.max(ICO_FILE_SIZE, maxResponseSize)); this.scs = new ServerConnectionStruct(recordTypeData); beginDeclarations(); }
@Override public boolean hasHeadersToEcho() { return scs.hasHeadersToEcho(); }
@Override public HTTPServerConfig echoHeaders(int maxSingleHeaderLength, HTTPHeader... headers) { scs.headersToEcho(maxSingleHeaderLength, headers); return this; }
this.connectionStruct().inFlightPayloadSize());
if ((echoIndex = serverConnection.scs.isEchoHeader(header)) >= 0 ) {
int spaceForEchos = serverCoord.connectionStruct().inFlightPayloadSize();
private int echoHeaders(DataOutputBlobWriter<NetPayloadSchema> outputStream, int len, final int blobMask, byte[] blob, final int bytePosition, ChannelReader reader) { HTTPHeader[] headersToEcho = conStruct.headersToEcho(); if (null!=headersToEcho) { int newLinePos = (bytePosition+len-2); assert(blob[newLinePos&blobMask]=='\r'); assert(blob[(1+newLinePos)&blobMask]=='\n'); if (blob[newLinePos&blobMask]=='\r') { len-=2;//confirm it is \r\n? add assert! DataOutputBlobWriter.write(outputStream, blob, bytePosition, len, blobMask); len = 0;//so the following write will not write a second time. for(int i=0; i<headersToEcho.length; i++) { HTTPHeader header = headersToEcho[i]; if (!reader.structured().isNull(header)) { System.err.println("echo header "+header); spec.writeHeader(outputStream, header, reader.structured().read(header)); } //TODO: confirm works with chunked and not } outputStream.write(BYTES_NEWLINE); } } return len; }
serverConfig.ensureServerCanWrite(SSLUtil.MinTLSBlock); ServerConnectionStruct scs = new ServerConnectionStruct(gm.recordTypeData); ServerCoordinator serverCoord = new ServerCoordinator(tlsCertificates, bindHost, port, scs,
HTTPHeader[] toEcho = scs.headersToEcho(); if (null != toEcho) { int h = toEcho.length;