@@ -625,12 +625,13 @@ parseH2Frame(trantor::MsgBuffer *msg)
625625 // MSB is reserved for future use
626626 const uint32_t streamId = header.readU32BE () & ((1U << 31 ) - 1 );
627627
628- if (type >= (uint8_t )H2FrameType::NumEntries)
629- {
630- // TODO: Handle fatal protocol error
631- LOG_TRACE << " Unsupported H2 frame type: " << (int )type;
632- return {std::nullopt , streamId, 0 , true , 0 };
633- }
628+ // This check is not need as HTTP/2 allows unknown frame types to be
629+ // ignored for forward compatibility.
630+ // if (type >= (uint8_t)H2FrameType::NumEntries)
631+ // {
632+ // LOG_TRACE << "Unsupported H2 frame type: " << (int)type;
633+ // return {std::nullopt, streamId, 0, true, 0};
634+ // }
634635
635636 LOG_TRACE << " H2 frame: length=" << length << " type=" << (int )type
636637 << " flags=" << (int )flags << " streamId=" << streamId;
@@ -657,7 +658,7 @@ parseH2Frame(trantor::MsgBuffer *msg)
657658 frame = RstStreamFrame::parse (payload, flags);
658659 else
659660 {
660- LOG_WARN << " Unsupported H2 frame type: " << (int )type;
661+ LOG_TRACE << " Unsupported H2 frame type: " << (int )type;
661662 msg->retrieve (length + 9 );
662663 return {std::nullopt , streamId, 0 , false , 0 };
663664 }
@@ -976,28 +977,27 @@ void Http2Transport::onRecvMessage(const trantor::TcpConnectionPtr &,
976977 auto it = currentDataSend.value_or (pendingDataSend.begin ());
977978 while (it != pendingDataSend.end ())
978979 {
979- auto &stream = streams[it->first ];
980- auto [sentOffset, done] = sendBodyForStream (stream, it->second );
980+ auto streamIt = streams.find (it->first );
981+ assert (streamIt != streams.end ()); // FATAL: must exist
982+ auto [sentOffset, done] =
983+ sendBodyForStream (streamIt->second , it->second );
981984 if (done)
982985 {
983986 it = pendingDataSend.erase (it);
984- if (it != pendingDataSend.end ())
985- currentDataSend = it;
986- else
987+ if (it == pendingDataSend.end ())
987988 {
988989 currentDataSend = std::nullopt ;
989990 break ;
990991 }
992+ currentDataSend = it;
991993 continue ;
992994 }
993995 it->second = sentOffset;
994- if (availableTxWindow != 0 )
995- {
996- ++it;
997- currentDataSend = it;
998- }
999- else
996+ if (availableTxWindow == 0 )
1000997 break ;
998+
999+ ++it;
1000+ currentDataSend = it;
10011001 }
10021002 }
10031003 else if (std::holds_alternative<SettingsFrame>(frame))
0 commit comments