Search in sources :

Example 1 with Http2SettingsFW

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

the class HttpServerFactory method decodeHttp2Settings.

private int decodeHttp2Settings(Http2Server server, long traceId, long authorization, long budgetId, DirectBuffer buffer, int offset, int limit) {
    int progress = offset;
    final Http2SettingsFW http2Settings = http2SettingsRO.wrap(buffer, offset, limit);
    final int streamId = http2Settings.streamId();
    final boolean ack = http2Settings.ack();
    final int length = http2Settings.length();
    Http2ErrorCode error = Http2ErrorCode.NO_ERROR;
    if (ack && length != 0) {
        error = Http2ErrorCode.FRAME_SIZE_ERROR;
    } else if (streamId != 0) {
        error = Http2ErrorCode.PROTOCOL_ERROR;
    }
    if (error != Http2ErrorCode.NO_ERROR) {
        server.onDecodeError(traceId, authorization, error);
        server.decoder = decodeHttp2IgnoreAll;
    } else {
        server.onDecodeSettings(traceId, authorization, http2Settings);
        server.decoder = decodeHttp2FrameType;
        progress = http2Settings.limit();
    }
    return progress;
}
Also used : Http2SettingsFW(io.aklivity.zilla.runtime.binding.http.internal.codec.Http2SettingsFW) Http2ErrorCode(io.aklivity.zilla.runtime.binding.http.internal.codec.Http2ErrorCode)

Aggregations

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