@@ -827,11 +827,11 @@ void Http2Transport::onRecvMessage(const trantor::TcpConnectionPtr &,
827827 LOG_TRACE << dump_hex_beautiful (msg->peek (), msg->readableBytes ());
828828 while (true )
829829 {
830- if (avaliableRxWindow < windowIncreaseThreshold)
830+ if (availableRxWindow < windowIncreaseThreshold)
831831 {
832832 WindowUpdateFrame windowUpdateFrame (windowIncreaseSize);
833833 sendFrame (windowUpdateFrame, 0 );
834- avaliableRxWindow += windowIncreaseSize;
834+ availableRxWindow += windowIncreaseSize;
835835 }
836836
837837 if (msg->readableBytes () == 0 )
@@ -952,8 +952,8 @@ void Http2Transport::onRecvMessage(const trantor::TcpConnectionPtr &,
952952 if (std::holds_alternative<WindowUpdateFrame>(frame))
953953 {
954954 auto &f = std::get<WindowUpdateFrame>(frame);
955- if (std::numeric_limits<decltype (avaliableTxWindow )>::max () -
956- avaliableTxWindow <
955+ if (std::numeric_limits<decltype (availableTxWindow )>::max () -
956+ availableTxWindow <
957957 f.windowSizeIncrement )
958958 {
959959 LOG_TRACE << " Flow control error: TX window size overflow" ;
@@ -962,7 +962,7 @@ void Http2Transport::onRecvMessage(const trantor::TcpConnectionPtr &,
962962 " TX window size overflow" );
963963 break ;
964964 }
965- avaliableTxWindow += f.windowSizeIncrement ;
965+ availableTxWindow += f.windowSizeIncrement ;
966966
967967 // Find if we have a stream that can be resumed
968968 if (currentDataSend.has_value () == false && pendingDataSend.empty ())
@@ -986,7 +986,7 @@ void Http2Transport::onRecvMessage(const trantor::TcpConnectionPtr &,
986986 continue ;
987987 }
988988 it->second = sentOffset;
989- if (avaliableTxWindow != 0 )
989+ if (availableTxWindow != 0 )
990990 {
991991 ++it;
992992 currentDataSend = it;
@@ -1008,6 +1008,7 @@ void Http2Transport::onRecvMessage(const trantor::TcpConnectionPtr &,
10081008 connectionErrored (streamId,
10091009 StreamCloseErrorCode::ProtocolError,
10101010 " HeaderTableSize too large" );
1011+ break ;
10111012 }
10121013 // 64 is large enough
10131014 auto newBuf =
@@ -1052,15 +1053,15 @@ void Http2Transport::onRecvMessage(const trantor::TcpConnectionPtr &,
10521053 initialTxWindowSize = value;
10531054
10541055 // If first initial window update received, we need to
1055- // update all streams' avaliable window size (even if)
1056+ // update all streams' available window size (even if)
10561057 // it is going negative)
10571058 if (!firstInitalWindowUpdateReceived)
10581059 {
10591060 continue ;
10601061 }
10611062 for (auto &[_, stream] : streams)
10621063 {
1063- stream.avaliableTxWindow += diff;
1064+ stream.availableTxWindow += diff;
10641065 }
10651066 firstInitalWindowUpdateReceived = true ;
10661067 }
@@ -1376,17 +1377,8 @@ void Http2Transport::handleFrameForStream(const internal::H2Frame &frame,
13761377 bool isTrailers =
13771378 (stream.state == StreamState::ExpectingContinuationTrailers);
13781379 bool endHeaders = (flags & (uint8_t )H2HeadersFlags::EndHeaders) != 0 ;
1379- bool endStream = (flags & (uint8_t )H2HeadersFlags::EndStream) != 0 ;
1380-
1381- if (isTrailers && (endHeaders == true && endStream == false ))
1382- {
1383- connectionErrored (streamId,
1384- StreamCloseErrorCode::ProtocolError,
1385- " Trailers must end header and stream together" );
1386- return ;
1387- }
13881380
1389- if (endHeaders)
1381+ if (endHeaders && !isTrailers )
13901382 {
13911383 stream.state = StreamState::ExpectingData;
13921384 expectngContinuationStreamId = 0 ;
@@ -1400,25 +1392,22 @@ void Http2Transport::handleFrameForStream(const internal::H2Frame &frame,
14001392 return ;
14011393 }
14021394
1403- if (endStream)
1404- {
1405- stream.state = StreamState::Finished;
1406- responseSuccess (stream);
1407- return ;
1408- }
1395+ stream.state = StreamState::Finished;
1396+ responseSuccess (stream);
1397+ return ;
14091398 }
14101399 else if (std::holds_alternative<DataFrame>(frame))
14111400 {
14121401 auto &f = std::get<DataFrame>(frame);
14131402 auto [data, size] = f.getData ();
1414- if (avaliableRxWindow < size)
1403+ if (availableRxWindow < size)
14151404 {
14161405 connectionErrored (streamId,
14171406 StreamCloseErrorCode::FlowControlError,
14181407 " Too much for connection-level flow control" );
14191408 return ;
14201409 }
1421- else if (stream.avaliableRxWindow < size)
1410+ else if (stream.availableRxWindow < size)
14221411 {
14231412 connectionErrored (streamId,
14241413 StreamCloseErrorCode::FlowControlError,
@@ -1434,8 +1423,8 @@ void Http2Transport::handleFrameForStream(const internal::H2Frame &frame,
14341423 " Unexpected data frame" );
14351424 return ;
14361425 }
1437- avaliableRxWindow -= size;
1438- stream.avaliableRxWindow -= size;
1426+ availableRxWindow -= size;
1427+ stream.availableRxWindow -= size;
14391428 LOG_TRACE << " Data frame received: size=" << size;
14401429
14411430 stream.body .append ((char *)data, size);
@@ -1458,18 +1447,18 @@ void Http2Transport::handleFrameForStream(const internal::H2Frame &frame,
14581447 return ;
14591448 }
14601449
1461- if (stream.avaliableRxWindow < windowIncreaseThreshold)
1450+ if (stream.availableRxWindow < windowIncreaseThreshold)
14621451 {
14631452 WindowUpdateFrame windowUpdateFrame (windowIncreaseSize);
14641453 sendFrame (windowUpdateFrame, streamId);
1465- stream.avaliableRxWindow += windowIncreaseSize;
1454+ stream.availableRxWindow += windowIncreaseSize;
14661455 }
14671456 }
14681457 else if (std::holds_alternative<WindowUpdateFrame>(frame))
14691458 {
14701459 auto &f = std::get<WindowUpdateFrame>(frame);
1471- if (std::numeric_limits<decltype (stream.avaliableTxWindow )>::max () -
1472- stream.avaliableTxWindow <
1460+ if (std::numeric_limits<decltype (stream.availableTxWindow )>::max () -
1461+ stream.availableTxWindow <
14731462 f.windowSizeIncrement )
14741463 {
14751464 LOG_TRACE << " Flow control error: stream TX window size overflow" ;
@@ -1478,8 +1467,8 @@ void Http2Transport::handleFrameForStream(const internal::H2Frame &frame,
14781467 " Stream TX window size overflow" );
14791468 return ;
14801469 }
1481- stream.avaliableTxWindow += f.windowSizeIncrement ;
1482- if (avaliableTxWindow == 0 )
1470+ stream.availableTxWindow += f.windowSizeIncrement ;
1471+ if (availableTxWindow == 0 )
14831472 return ;
14841473
14851474 auto it = pendingDataSend.find (streamId);
@@ -1530,8 +1519,8 @@ internal::H2Stream &Http2Transport::createStream(int32_t streamId)
15301519 }
15311520 auto &stream = streams[streamId];
15321521 stream.streamId = streamId;
1533- stream.avaliableTxWindow = initialTxWindowSize;
1534- stream.avaliableRxWindow = initialRxWindowSize;
1522+ stream.availableTxWindow = initialTxWindowSize;
1523+ stream.availableRxWindow = initialRxWindowSize;
15351524 return stream;
15361525}
15371526
@@ -1629,12 +1618,12 @@ std::pair<size_t, bool> Http2Transport::sendBodyForStream(
16291618 size_t size)
16301619{
16311620 auto streamId = stream.streamId ;
1632- if (stream.avaliableTxWindow == 0 || avaliableTxWindow == 0 )
1621+ if (stream.availableTxWindow == 0 || availableTxWindow == 0 )
16331622 return {0 , false };
16341623
16351624 int64_t maxSendSize = size;
1636- maxSendSize = (std::min)(maxSendSize, stream.avaliableTxWindow );
1637- maxSendSize = (std::min)(maxSendSize, avaliableTxWindow );
1625+ maxSendSize = (std::min)(maxSendSize, stream.availableTxWindow );
1626+ maxSendSize = (std::min)(maxSendSize, availableTxWindow );
16381627 bool sendEverything = maxSendSize == size;
16391628
16401629 size_t sent = 0 ;
@@ -1650,8 +1639,8 @@ std::pair<size_t, bool> Http2Transport::sendBodyForStream(
16501639 sent += readSize;
16511640 sendFrame (dataFrame, streamId);
16521641
1653- stream.avaliableTxWindow -= readSize;
1654- avaliableTxWindow -= readSize;
1642+ stream.availableTxWindow -= readSize;
1643+ availableTxWindow -= readSize;
16551644 }
16561645 return {sent, sendEverything};
16571646}
@@ -1661,7 +1650,7 @@ std::pair<size_t, bool> Http2Transport::sendBodyForStream(
16611650 size_t offset)
16621651{
16631652 auto streamId = stream.streamId ;
1664- if (stream.avaliableTxWindow == 0 || avaliableTxWindow == 0 )
1653+ if (stream.availableTxWindow == 0 || availableTxWindow == 0 )
16651654 return {offset, false };
16661655
16671656 // Special handling for multipart because different underlying code
0 commit comments