Search in sources :

Example 1 with HttpEndExFW

use of io.aklivity.zilla.runtime.binding.http.internal.types.stream.HttpEndExFW in project zilla by aklivity.

the class HttpClientFactory method decodeTrailers.

private int decodeTrailers(HttpClient client, long traceId, long authorization, long budgetId, int reserved, DirectBuffer buffer, int offset, int limit) {
    int progress = offset;
    final int endOfTrailersAt = limitOfBytes(buffer, offset, limit, CRLFCRLF_BYTES);
    if (endOfTrailersAt != -1) {
        // TODO
        final HttpEndExFW httpEndEx = endExRW.wrap(writeBuffer, 0, writeBuffer.capacity()).typeId(httpTypeId).build();
        client.onDecodeTrailers(traceId, authorization, httpEndEx);
        progress = endOfTrailersAt;
        client.decoder = decodeEmptyLines;
    } else if (buffer.getByte(offset) == '\r' && buffer.getByte(offset + 1) == '\n') {
        client.onDecodeTrailers(traceId, authorization, EMPTY_OCTETS);
        progress += 2;
        client.decoder = decodeEmptyLines;
    }
    return progress;
}
Also used : HttpEndExFW(io.aklivity.zilla.runtime.binding.http.internal.types.stream.HttpEndExFW)

Example 2 with HttpEndExFW

use of io.aklivity.zilla.runtime.binding.http.internal.types.stream.HttpEndExFW in project zilla by aklivity.

the class HttpServerFactory method decodeTrailers.

private int decodeTrailers(HttpServer server, long traceId, long authorization, long budgetId, int reserved, DirectBuffer buffer, int offset, int limit) {
    int progress = offset;
    final int endOfTrailersAt = limitOfBytes(buffer, offset, limit, CRLFCRLF_BYTES);
    if (endOfTrailersAt != -1) {
        // TODO
        final HttpEndExFW httpEndEx = endExRW.wrap(writeBuffer, 0, writeBuffer.capacity()).typeId(httpTypeId).build();
        server.onDecodeTrailers(traceId, authorization, httpEndEx);
        progress = endOfTrailersAt;
        server.decoder = decodeEmptyLines;
    } else if (buffer.getByte(offset) == '\r' && buffer.getByte(offset + 1) == '\n') {
        server.onDecodeTrailers(traceId, authorization, EMPTY_OCTETS);
        progress += 2;
        server.decoder = decodeEmptyLines;
    }
    return progress;
}
Also used : HttpEndExFW(io.aklivity.zilla.runtime.binding.http.internal.types.stream.HttpEndExFW)

Aggregations

HttpEndExFW (io.aklivity.zilla.runtime.binding.http.internal.types.stream.HttpEndExFW)2