/** * Checks that the actual content size matches the expected. We check this proactivly, rather than as the data is read * @param frameLength The amount of data in the frame * @param last If this is the last frame */ void updateContentSize(long frameLength, boolean last) { if(contentLengthRemaining != -1) { contentLengthRemaining -= frameLength; if(contentLengthRemaining < 0) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing stream %s on %s as data length exceeds content size", streamId, getFramedChannel()); getFramedChannel().sendRstStream(streamId, Http2Channel.ERROR_PROTOCOL_ERROR); } else if(last && contentLengthRemaining != 0) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing stream %s on %s as data length was less than content size", streamId, getFramedChannel()); getFramedChannel().sendRstStream(streamId, Http2Channel.ERROR_PROTOCOL_ERROR); } } }
@Override protected void handleHeaderData(FrameHeaderData headerData) { Http2FrameHeaderParser data = (Http2FrameHeaderParser) headerData; Http2PushBackParser parser = data.getParser(); if(parser instanceof Http2DataFrameParser) { remainingPadding = ((Http2DataFrameParser) parser).getPadding(); if(remainingPadding > 0) { try { updateFlowControlWindow(remainingPadding + 1); } catch (IOException e) { IoUtils.safeClose(getFramedChannel()); throw new RuntimeException(e); } } } else if(parser instanceof Http2HeadersParser) { if(trailersHandler != null) { trailersHandler.handleTrailers(((Http2HeadersParser) parser).getHeaderMap()); } } handleFinalFrame(data); }
/** * Checks that the actual content size matches the expected. We check this proactivly, rather than as the data is read * @param frameLength The amount of data in the frame * @param last If this is the last frame */ void updateContentSize(long frameLength, boolean last) { if(contentLengthRemaining != -1) { contentLengthRemaining -= frameLength; if(contentLengthRemaining < 0) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing stream %s on %s as data length exceeds content size", streamId, getFramedChannel()); getFramedChannel().sendRstStream(streamId, Http2Channel.ERROR_PROTOCOL_ERROR); } else if(last && contentLengthRemaining != 0) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing stream %s on %s as data length was less than content size", streamId, getFramedChannel()); getFramedChannel().sendRstStream(streamId, Http2Channel.ERROR_PROTOCOL_ERROR); } } }
/** * Checks that the actual content size matches the expected. We check this proactivly, rather than as the data is read * @param frameLength The amount of data in the frame * @param last If this is the last frame */ void updateContentSize(long frameLength, boolean last) { if(contentLengthRemaining != -1) { contentLengthRemaining -= frameLength; if(contentLengthRemaining < 0) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing stream %s on %s as data length exceeds content size", streamId, getFramedChannel()); getFramedChannel().sendRstStream(streamId, Http2Channel.ERROR_PROTOCOL_ERROR); } else if(last && contentLengthRemaining != 0) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing stream %s on %s as data length was less than content size", streamId, getFramedChannel()); getFramedChannel().sendRstStream(streamId, Http2Channel.ERROR_PROTOCOL_ERROR); } } }
@Override protected void handleHeaderData(FrameHeaderData headerData) { Http2FrameHeaderParser data = (Http2FrameHeaderParser) headerData; Http2PushBackParser parser = data.getParser(); if(parser instanceof Http2DataFrameParser) { remainingPadding = ((Http2DataFrameParser) parser).getPadding(); if(remainingPadding > 0) { try { updateFlowControlWindow(remainingPadding + 1); } catch (IOException e) { IoUtils.safeClose(getFramedChannel()); throw new RuntimeException(e); } } } else if(parser instanceof Http2HeadersParser) { if(trailersHandler != null) { trailersHandler.handleTrailers(((Http2HeadersParser) parser).getHeaderMap()); } } handleFinalFrame(data); }
@Override protected void handleHeaderData(FrameHeaderData headerData) { Http2FrameHeaderParser data = (Http2FrameHeaderParser) headerData; Http2PushBackParser parser = data.getParser(); if(parser instanceof Http2DataFrameParser) { remainingPadding = ((Http2DataFrameParser) parser).getPadding(); if(remainingPadding > 0) { try { updateFlowControlWindow(remainingPadding + 1); } catch (IOException e) { IoUtils.safeClose(getFramedChannel()); throw new RuntimeException(e); } } } else if(parser instanceof Http2HeadersParser) { if(trailersHandler != null) { trailersHandler.handleTrailers(((Http2HeadersParser) parser).getHeaderMap()); } } handleFinalFrame(data); }