use of com.webpieces.http2.api.dto.lowlevel.lib.Http2Frame in project webpieces by deanhiller.
the class HpackParserImpl method processFrameImpl.
private void processFrameImpl(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.addParsedMessage((Http2Msg) frame);
} else {
throw new IllegalStateException("bug forgot support for frame=" + frame);
}
}
use of com.webpieces.http2.api.dto.lowlevel.lib.Http2Frame in project webpieces by deanhiller.
the class HpackParserImpl method unmarshalImpl.
private UnmarshalStateImpl unmarshalImpl(UnmarshalStateImpl state, DataWrapper newData) {
// reset any parsed frames
state.clearParsedFrames();
state.addToDataToParseSize(newData.getReadableSize());
Http2Memento result = parser.parse(state.getLowLevelState(), newData);
state.addHalfParsedSize(result.getNumBytesJustParsed());
List<Http2Frame> parsedFrames = result.getParsedFrames();
for (Http2Frame frame : parsedFrames) {
processFrame(state, frame);
}
return state;
}
use of com.webpieces.http2.api.dto.lowlevel.lib.Http2Frame in project webpieces by deanhiller.
the class HpackParserImpl method createPushPromiseData.
private DataWrapper createPushPromiseData(MarshalStateImpl state, Http2Push p) {
long maxFrameSize = state.getMaxRemoteFrameSize();
Encoder encoder = state.getEncoder();
List<Http2Frame> headerFrames = encoding.translateToFrames(maxFrameSize, encoder, p);
return translate(headerFrames);
}
use of com.webpieces.http2.api.dto.lowlevel.lib.Http2Frame in project webpieces by deanhiller.
the class HpackParserImpl method translate.
private DataWrapper translate(List<Http2Frame> headerFrames) {
DataWrapper allData = DataWrapperGeneratorFactory.EMPTY;
for (Http2Frame f : headerFrames) {
DataWrapper frameData = parser.marshal(f);
allData = dataGen.chainDataWrappers(allData, frameData);
}
return allData;
}
use of com.webpieces.http2.api.dto.lowlevel.lib.Http2Frame in project webpieces by deanhiller.
the class ContinuationMarshaller method marshal.
@Override
public DataWrapper marshal(Http2Frame frame) {
ContinuationFrame castFrame = (ContinuationFrame) frame;
byte value = 0x0;
if (castFrame.isEndHeaders())
value |= 0x4;
DataWrapper dataPayload = castFrame.getHeaderFragment();
return super.marshalFrame(frame, value, dataPayload);
}
Aggregations