Search in sources :

Example 1 with HasHeaderFragment

use of com.webpieces.http2parser.api.dto.lib.HasHeaderFragment in project webpieces by deanhiller.

the class HpackParserImpl method processFrame.

private void processFrame(UnmarshalStateImpl state, Http2Frame frame) {
    List<HasHeaderFragment> headerFragList = state.getHeadersToCombine();
    if (frame instanceof HasHeaderFragment) {
        HasHeaderFragment headerFrame = (HasHeaderFragment) frame;
        headerFragList.add(headerFrame);
        validateHeader(state, headerFrame);
        if (headerFrame.isEndHeaders())
            combineAndSendHeadersToClient(state);
        return;
    } else if (headerFragList.size() > 0) {
        throw new ConnectionException(CancelReasonCode.HEADERS_MIXED_WITH_FRAMES, state.getLogId(), frame.getStreamId(), "Parser in the middle of accepting headers(spec " + "doesn't allow frames between header fragments).  frame=" + frame + " list=" + headerFragList);
    }
    if (frame instanceof UnknownFrame && ignoreUnkownFrames) {
    //do nothing
    } else if (frame instanceof Http2Msg) {
        state.getParsedFrames().add((Http2Msg) frame);
    } else {
        throw new IllegalStateException("bug forgot support for frame=" + frame);
    }
}
Also used : HasHeaderFragment(com.webpieces.http2parser.api.dto.lib.HasHeaderFragment) UnknownFrame(com.webpieces.http2parser.api.dto.UnknownFrame) Http2Msg(com.webpieces.http2parser.api.dto.lib.Http2Msg) ConnectionException(com.webpieces.http2parser.api.dto.error.ConnectionException)

Aggregations

UnknownFrame (com.webpieces.http2parser.api.dto.UnknownFrame)1 ConnectionException (com.webpieces.http2parser.api.dto.error.ConnectionException)1 HasHeaderFragment (com.webpieces.http2parser.api.dto.lib.HasHeaderFragment)1 Http2Msg (com.webpieces.http2parser.api.dto.lib.Http2Msg)1