private HpackEncoder.State encodeContinuationFrame(HeaderMap headers, PooledByteBuffer current) { ByteBuffer currentBuffer; HpackEncoder.State result;//continuation frame //note that if the buffers are small we may not actually need a continuation here //but it greatly reduces the code complexity //back fill the length currentBuffer = current.getBuffer(); currentBuffer.put((byte) 0); currentBuffer.put((byte) 0); currentBuffer.put((byte) 0); currentBuffer.put((byte) Http2Channel.FRAME_TYPE_CONTINUATION); //type currentBuffer.put((byte) 0); //back fill the flags Http2ProtocolUtils.putInt(currentBuffer, getStreamId()); result = encoder.encode(headers, currentBuffer); int contFrameLength = currentBuffer.position() - 9; currentBuffer.put(0, (byte) ((contFrameLength >> 16) & 0xFF)); currentBuffer.put(1, (byte) ((contFrameLength >> 8) & 0xFF)); currentBuffer.put(2, (byte) (contFrameLength & 0xFF)); currentBuffer.put(4, (byte) (result == HpackEncoder.State.COMPLETE ? Http2Channel.HEADERS_FLAG_END_HEADERS : 0 )); //flags return result; }
HpackEncoder.State result = encoder.encode(headers, firstBuffer); PooledByteBuffer current = firstHeaderBuffer; int headerFrameLength = firstBuffer.position() - 9 + paddingBytes; HpackEncoder.State result = encoder.encode(trailers, firstTrailerBuffer.getBuffer()); if (result != HpackEncoder.State.COMPLETE) { throw UndertowMessages.MESSAGES.http2TrailerToLargeForSingleBuffer();
private HpackEncoder.State encodeContinuationFrame(HeaderMap headers, PooledByteBuffer current) { ByteBuffer currentBuffer; HpackEncoder.State result;//continuation frame //note that if the buffers are small we may not actually need a continuation here //but it greatly reduces the code complexity //back fill the length currentBuffer = current.getBuffer(); currentBuffer.put((byte) 0); currentBuffer.put((byte) 0); currentBuffer.put((byte) 0); currentBuffer.put((byte) Http2Channel.FRAME_TYPE_CONTINUATION); //type currentBuffer.put((byte) 0); //back fill the flags Http2ProtocolUtils.putInt(currentBuffer, getStreamId()); result = encoder.encode(headers, currentBuffer); int contFrameLength = currentBuffer.position() - 9; currentBuffer.put(0, (byte) ((contFrameLength >> 16) & 0xFF)); currentBuffer.put(1, (byte) ((contFrameLength >> 8) & 0xFF)); currentBuffer.put(2, (byte) (contFrameLength & 0xFF)); currentBuffer.put(4, (byte) (result == HpackEncoder.State.COMPLETE ? Http2Channel.HEADERS_FLAG_END_HEADERS : 0 )); //flags return result; }
private HpackEncoder.State encodeContinuationFrame(HeaderMap headers, PooledByteBuffer current) { ByteBuffer currentBuffer; HpackEncoder.State result;//continuation frame //note that if the buffers are small we may not actually need a continuation here //but it greatly reduces the code complexity //back fill the length currentBuffer = current.getBuffer(); currentBuffer.put((byte) 0); currentBuffer.put((byte) 0); currentBuffer.put((byte) 0); currentBuffer.put((byte) Http2Channel.FRAME_TYPE_CONTINUATION); //type currentBuffer.put((byte) 0); //back fill the flags Http2ProtocolUtils.putInt(currentBuffer, getStreamId()); result = encoder.encode(headers, currentBuffer); int contFrameLength = currentBuffer.position() - 9; currentBuffer.put(0, (byte) ((contFrameLength >> 16) & 0xFF)); currentBuffer.put(1, (byte) ((contFrameLength >> 8) & 0xFF)); currentBuffer.put(2, (byte) (contFrameLength & 0xFF)); currentBuffer.put(4, (byte) (result == HpackEncoder.State.COMPLETE ? Http2Channel.HEADERS_FLAG_END_HEADERS : 0 )); //flags return result; }
HpackEncoder.State result = encoder.encode(headers, firstBuffer); PooledByteBuffer current = firstHeaderBuffer; int headerFrameLength = firstBuffer.position() - 9 + paddingBytes; HpackEncoder.State result = encoder.encode(trailers, firstTrailerBuffer.getBuffer()); if (result != HpackEncoder.State.COMPLETE) { throw UndertowMessages.MESSAGES.http2TrailerToLargeForSingleBuffer();
HpackEncoder.State result = encoder.encode(headers, firstBuffer); PooledByteBuffer current = firstHeaderBuffer; int headerFrameLength = firstBuffer.position() - 9 + paddingBytes; HpackEncoder.State result = encoder.encode(trailers, firstTrailerBuffer.getBuffer()); if (result != HpackEncoder.State.COMPLETE) { throw UndertowMessages.MESSAGES.http2TrailerToLargeForSingleBuffer();