Search in sources :

Example 1 with Http2ContinuationFW

use of io.aklivity.zilla.runtime.binding.http.internal.codec.Http2ContinuationFW in project zilla by aklivity.

the class HttpServerFactory method decodeHttp2Continuation.

private int decodeHttp2Continuation(Http2Server server, long traceId, long authorization, long budgetId, DirectBuffer buffer, int offset, int limit) {
    int progress = offset;
    final Http2ContinuationFW http2Continuation = http2ContinuationRO.wrap(buffer, offset, limit);
    final int streamId = http2Continuation.streamId();
    final int length = http2Continuation.length();
    Http2ErrorCode error = Http2ErrorCode.NO_ERROR;
    if ((streamId & 0x01) != 0x01 || streamId != server.continuationStreamId) {
        error = Http2ErrorCode.PROTOCOL_ERROR;
    }
    if (server.headersSlotOffset + length > headersPool.slotCapacity()) {
        // TODO: decoded header list size check, recoverable error instead
        error = Http2ErrorCode.PROTOCOL_ERROR;
    }
    if (error != Http2ErrorCode.NO_ERROR) {
        server.onDecodeError(traceId, authorization, error);
        server.decoder = decodeHttp2IgnoreAll;
    } else {
        server.onDecodeContinuation(traceId, authorization, http2Continuation);
        server.decoder = decodeHttp2FrameType;
        progress = http2Continuation.limit();
    }
    return progress;
}
Also used : Http2ContinuationFW(io.aklivity.zilla.runtime.binding.http.internal.codec.Http2ContinuationFW) Http2ErrorCode(io.aklivity.zilla.runtime.binding.http.internal.codec.Http2ErrorCode)

Aggregations

Http2ContinuationFW (io.aklivity.zilla.runtime.binding.http.internal.codec.Http2ContinuationFW)1 Http2ErrorCode (io.aklivity.zilla.runtime.binding.http.internal.codec.Http2ErrorCode)1