protected boolean hasFlag(int bit) { return headerParser.hasFlag(bit); }
protected boolean isEndStream() { return headerParser.hasFlag(Flags.END_STREAM); }
protected boolean isPadding() { return headerParser.hasFlag(Flags.PADDING); }
protected boolean hasFlag(int bit) { return headerParser.hasFlag(bit); }
protected boolean hasFlag(int bit) { return headerParser.hasFlag(bit); }
protected boolean hasFlag(int bit) { return headerParser.hasFlag(bit); }
protected boolean isEndStream() { return headerParser.hasFlag(Flags.END_STREAM); }
protected boolean isPadding() { return headerParser.hasFlag(Flags.PADDING); }
protected boolean parseHeader(ByteBuffer buffer) { if (!headerParser.parse(buffer)) return false; if (LOG.isDebugEnabled()) LOG.debug("Parsed {} frame header from {}", headerParser, buffer); if (headerParser.getLength() > getMaxFrameLength()) return connectionFailure(buffer, ErrorCode.FRAME_SIZE_ERROR, "invalid_frame_length"); FrameType frameType = FrameType.from(getFrameType()); if (continuation) { // SPEC: CONTINUATION frames must be consecutive. if (frameType != FrameType.CONTINUATION) return connectionFailure(buffer, ErrorCode.PROTOCOL_ERROR, "expected_continuation_frame"); if (headerParser.hasFlag(Flags.END_HEADERS)) continuation = false; } else { if (frameType == FrameType.HEADERS) continuation = !headerParser.hasFlag(Flags.END_HEADERS); else if (frameType == FrameType.CONTINUATION) return connectionFailure(buffer, ErrorCode.PROTOCOL_ERROR, "unexpected_continuation_frame"); } state = State.BODY; return true; }
protected boolean parseHeader(ByteBuffer buffer) { if (!headerParser.parse(buffer)) return false; if (LOG.isDebugEnabled()) LOG.debug("Parsed {} frame header from {}", headerParser, buffer); if (headerParser.getLength() > getMaxFrameLength()) return connectionFailure(buffer, ErrorCode.FRAME_SIZE_ERROR, "invalid_frame_length"); FrameType frameType = FrameType.from(getFrameType()); if (continuation) { // SPEC: CONTINUATION frames must be consecutive. if (frameType != FrameType.CONTINUATION) return connectionFailure(buffer, ErrorCode.PROTOCOL_ERROR, "expected_continuation_frame"); if (headerParser.hasFlag(Flags.END_HEADERS)) continuation = false; } else { if (frameType == FrameType.HEADERS) continuation = !headerParser.hasFlag(Flags.END_HEADERS); else if (frameType == FrameType.CONTINUATION) return connectionFailure(buffer, ErrorCode.PROTOCOL_ERROR, "unexpected_continuation_frame"); } state = State.BODY; return true; }