Search in sources :

Example 1 with Http2DataFW

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

the class HttpServerFactory method decodeHttp2Data.

private int decodeHttp2Data(Http2Server server, long traceId, long authorization, long budgetId, DirectBuffer buffer, int offset, int limit) {
    int progress = offset;
    final int length = limit - progress;
    if (length != 0) {
        Http2ErrorCode error = Http2ErrorCode.NO_ERROR;
        Http2DataFW http2Data = http2DataRO.wrap(buffer, offset, limit);
        final int streamId = http2Data.streamId();
        if ((streamId & 0x01) != 0x01) {
            error = Http2ErrorCode.PROTOCOL_ERROR;
        }
        if (error != Http2ErrorCode.NO_ERROR) {
            server.onDecodeError(traceId, authorization, error);
            server.decoder = decodeHttp2IgnoreAll;
        } else {
            server.decodableDataBytes = http2Data.dataLength();
            progress = http2Data.dataOffset();
            server.decoder = decodeHttp2DataPayload;
        }
    }
    return progress;
}
Also used : Http2ErrorCode(io.aklivity.zilla.runtime.binding.http.internal.codec.Http2ErrorCode) Http2DataFW(io.aklivity.zilla.runtime.binding.http.internal.codec.Http2DataFW)

Aggregations

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