| 697 | } |
| 698 | |
| 699 | H2ParseResult H2Context::OnData( |
| 700 | butil::IOBufBytesIterator& it, const H2FrameHead& frame_head) { |
| 701 | uint32_t frag_size = frame_head.payload_size; |
| 702 | uint8_t pad_length = 0; |
| 703 | if (frame_head.flags & H2_FLAGS_PADDED) { |
| 704 | --frag_size; |
| 705 | pad_length = LoadUint8(it); |
| 706 | } |
| 707 | if (frag_size < pad_length) { |
| 708 | LOG(ERROR) << "Invalid payload_size=" << frame_head.payload_size; |
| 709 | return MakeH2Error(H2_FRAME_SIZE_ERROR); |
| 710 | } |
| 711 | frag_size -= pad_length; |
| 712 | H2StreamContext* sctx = FindStream(frame_head.stream_id); |
| 713 | if (sctx == NULL) { |
| 714 | // If a DATA frame is received whose stream is not in "open" or "half-closed (local)" state, |
| 715 | // the recipient MUST respond with a stream error (Section 5.4.2) of type STREAM_CLOSED. |
| 716 | // Ignore the message without closing the socket. |
| 717 | H2StreamContext tmp_sctx(false); |
| 718 | tmp_sctx.Init(this, frame_head.stream_id); |
| 719 | tmp_sctx.OnData(it, frame_head, frag_size, pad_length); |
| 720 | DeferWindowUpdate(tmp_sctx.ReleaseDeferredWindowUpdate()); |
| 721 | |
| 722 | LOG(ERROR) << "Fail to find stream_id=" << frame_head.stream_id; |
| 723 | return MakeH2Error(H2_STREAM_CLOSED_ERROR, frame_head.stream_id); |
| 724 | } |
| 725 | return sctx->OnData(it, frame_head, frag_size, pad_length); |
| 726 | } |
| 727 | |
| 728 | H2ParseResult H2StreamContext::OnData( |
| 729 | butil::IOBufBytesIterator& it, const H2FrameHead& frame_head, |
nothing calls this directly
no test coverage detected