@fails-components/webtransport 0.0.1-rc.2 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/CMakeLists.txt +5 -2
  2. package/package.json +1 -1
  3. package/platform/net/quiche/common/platform/impl/quiche_flags_impl.h +1 -54
  4. package/platform/quiche_platform_impl/quic_flags_impl.h +1 -27
  5. package/platform/quiche_platform_impl/quiche_flag_utils_impl.h +1 -16
  6. package/platform/quiche_platform_impl/quiche_flags_impl.h +6 -1
  7. package/src/http3client.cc +14 -2
  8. package/src/http3client.h +10 -15
  9. package/src/webtransport.js +4 -1
  10. package/third_party/boringssl/src/.clang-format +11 -0
  11. package/third_party/boringssl/src/crypto/CMakeLists.txt +0 -1
  12. package/third_party/boringssl/src/crypto/asn1/a_strex.c +61 -95
  13. package/third_party/boringssl/src/crypto/asn1/asn1_par.c +31 -9
  14. package/third_party/boringssl/src/crypto/asn1/tasn_dec.c +33 -19
  15. package/third_party/boringssl/src/crypto/cipher_extra/asm/chacha20_poly1305_armv8.pl +8 -8
  16. package/third_party/boringssl/src/crypto/cipher_extra/derive_key.c +4 -4
  17. package/third_party/boringssl/src/crypto/cipher_extra/e_des.c +1 -0
  18. package/third_party/boringssl/src/crypto/cipher_extra/e_null.c +1 -0
  19. package/third_party/boringssl/src/crypto/cipher_extra/e_rc2.c +1 -0
  20. package/third_party/boringssl/src/crypto/cipher_extra/e_rc4.c +2 -0
  21. package/third_party/boringssl/src/crypto/fipsmodule/bcm.c +1 -0
  22. package/third_party/boringssl/src/crypto/fipsmodule/bn/asm/x86_64-mont5.pl +0 -197
  23. package/third_party/boringssl/src/crypto/fipsmodule/bn/bn_test.cc +0 -9
  24. package/third_party/boringssl/src/crypto/fipsmodule/bn/bn_tests.txt +68 -0
  25. package/third_party/boringssl/src/crypto/fipsmodule/bn/exponentiation.c +45 -40
  26. package/third_party/boringssl/src/crypto/fipsmodule/bn/internal.h +11 -8
  27. package/third_party/boringssl/src/crypto/fipsmodule/bn/rsaz_exp.c +15 -106
  28. package/third_party/boringssl/src/crypto/fipsmodule/bn/rsaz_exp.h +5 -1
  29. package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aes.c +12 -32
  30. package/third_party/boringssl/src/crypto/fipsmodule/cipher/internal.h +39 -0
  31. package/third_party/boringssl/src/crypto/{evp → fipsmodule/digestsign}/digestsign.c +7 -9
  32. package/third_party/boringssl/src/crypto/fipsmodule/ec/ec_key.c +1 -0
  33. package/third_party/boringssl/src/crypto/fipsmodule/ecdh/ecdh.c +2 -1
  34. package/third_party/boringssl/src/crypto/fipsmodule/ecdsa/ecdsa.c +1 -0
  35. package/third_party/boringssl/src/crypto/fipsmodule/hmac/hmac.c +1 -0
  36. package/third_party/boringssl/src/crypto/fipsmodule/service_indicator/service_indicator.c +1 -0
  37. package/third_party/boringssl/src/crypto/pkcs8/pkcs8_x509.c +4 -4
  38. package/third_party/boringssl/src/crypto/x509/algorithm.c +18 -1
  39. package/third_party/boringssl/src/crypto/x509/x_algor.c +1 -1
  40. package/third_party/boringssl/src/crypto/x509/x_crl.c +3 -3
  41. package/third_party/boringssl/src/crypto/x509/x_exten.c +1 -1
  42. package/third_party/boringssl/src/crypto/x509/x_name.c +1 -1
  43. package/third_party/boringssl/src/crypto/x509/x_pubkey.c +1 -1
  44. package/third_party/boringssl/src/crypto/x509/x_req.c +2 -2
  45. package/third_party/boringssl/src/crypto/x509/x_sig.c +1 -1
  46. package/third_party/boringssl/src/crypto/x509/x_spki.c +2 -2
  47. package/third_party/boringssl/src/crypto/x509/x_val.c +1 -1
  48. package/third_party/boringssl/src/crypto/x509/x_x509.c +2 -2
  49. package/third_party/boringssl/src/crypto/x509v3/v3_akey.c +1 -1
  50. package/third_party/boringssl/src/crypto/x509v3/v3_akeya.c +1 -1
  51. package/third_party/boringssl/src/crypto/x509v3/v3_bcons.c +2 -2
  52. package/third_party/boringssl/src/crypto/x509v3/v3_cpols.c +6 -6
  53. package/third_party/boringssl/src/crypto/x509v3/v3_crld.c +6 -6
  54. package/third_party/boringssl/src/crypto/x509v3/v3_enum.c +1 -1
  55. package/third_party/boringssl/src/crypto/x509v3/v3_extku.c +2 -2
  56. package/third_party/boringssl/src/crypto/x509v3/v3_genn.c +3 -3
  57. package/third_party/boringssl/src/crypto/x509v3/v3_info.c +3 -3
  58. package/third_party/boringssl/src/crypto/x509v3/v3_int.c +3 -3
  59. package/third_party/boringssl/src/crypto/x509v3/v3_ncons.c +2 -2
  60. package/third_party/boringssl/src/crypto/x509v3/v3_ocsp.c +2 -2
  61. package/third_party/boringssl/src/crypto/x509v3/v3_pcons.c +1 -1
  62. package/third_party/boringssl/src/crypto/x509v3/v3_pmaps.c +2 -2
  63. package/third_party/boringssl/src/crypto/x509v3/v3_skey.c +1 -1
  64. package/third_party/boringssl/src/decrepit/blowfish/blowfish.c +1 -0
  65. package/third_party/boringssl/src/decrepit/cast/cast.c +1 -0
  66. package/third_party/boringssl/src/decrepit/cfb/cfb.c +1 -0
  67. package/third_party/boringssl/src/decrepit/xts/xts.c +2 -1
  68. package/third_party/boringssl/src/fuzz/CMakeLists.txt +1 -0
  69. package/third_party/boringssl/src/fuzz/der_roundtrip.cc +57 -0
  70. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/0461791e54b4840c109637952eab43d9b938cab8 +0 -0
  71. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/06e57a7b98a403a00822739739924b97ae6c74e9 +0 -0
  72. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/078c3c1199930781466871c8dda69bec379286a4 +0 -0
  73. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/082a991742f652549e4b207100ee521f474e0a99 +1 -0
  74. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/091e3389548686c5038d04e3d76b9c4d30502074 +0 -0
  75. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/13e484c406efe97dc9d91f8b80a27b0e597c34da +1 -0
  76. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/153d254254345b61e20e7b37637dd6f6fd71ba01 +0 -0
  77. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/163605136e22f5b5302fe60d1f17837bee6b6b2b +1 -0
  78. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/1a96ec99b487b93052cd860c447e6d126dcc36d4 +1 -0
  79. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/1cc9ad96fcee279e8589b7071c7a0ccd111098f2 +1 -0
  80. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/229b8e1825512868e0e11a199ed71231dd41bb4f +1 -0
  81. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/236d820eadf7f84d70de7bb8be5f1c57a4005de2 +0 -0
  82. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/24fd9742dbdee3167509db4af245ad6f8c4c1e99 +0 -0
  83. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/2896f8deb3c4e8bdfeab743b22c64c92316880f7 +0 -0
  84. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/29b6252fe9c4d1186394b1664c421cca795b61a5 +0 -0
  85. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/2b4955132275314d1d377f37f93d8c1879a3519a +0 -0
  86. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/2e7112ac524a7a663632397cbb41f7dfd22e92c6 +0 -0
  87. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/396d197005432accf99bf0f483286e459eb24063 +1 -0
  88. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/3c75fe79266cf639f2180722a3f03f8fc3e25685 +1 -0
  89. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/3fbb104fb0eb6cae4af34d8a516998336b3a6778 +1 -0
  90. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/422fa995b3fdfed572b68b292062c330d6d05272 +0 -0
  91. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/428b48fc494cee828f0c27f77aef477cb2e1fd80 +0 -0
  92. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/4bd69e424b6fa38f9e63e58b8d0e95ac2d38d598 +1 -0
  93. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/4be7e1f134e1c55aeadeead515200f6f1e6254ba +0 -0
  94. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/4de268400e174db2dc306f45c833cf968a6c6546 +0 -0
  95. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/52d2c7efcd7da0eb7463829e05a598e36729bfae +1 -0
  96. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/53cf415eb9de49fb5a0cb46e745e413a99aa0779 +0 -0
  97. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/53ea84c48a5792281a46eb5a9c896d54ea3f1838 +1 -0
  98. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/5ba93c9db0cff93f52b521d7420e43f6eda2784f +0 -0
  99. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/5bab61eb53176449e25c2c82f172b82cb13ffb9d +1 -0
  100. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/5e5361730362736fe3e2804d8566e3c91454509b +0 -0
  101. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/6654fedb1fc4b07095695b062b5af4c2f12d59ae +0 -0
  102. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/6cad8b2a41194372ec897bece6512fe8331e274d +1 -0
  103. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/6f40330ec07e8e22f113f982b297ff7f86b8e485 +0 -0
  104. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/738f291e53e97c08dae378c71ef70a60e31ae900 +0 -0
  105. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/7396791821e64fc9340249a4bcbd2198e9f237db +0 -0
  106. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/7653595e28f23e62ea6707c99ca08c780a69335f +0 -0
  107. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/77de68daecd823babbb58edb1c8e14d7106e83bb +1 -0
  108. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/7cb5c71603a787032973d6ddc9c2c34638005784 +0 -0
  109. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/80a1e1ae75c1e5ef7bbde5f5877e3e5b26b3cf58 +0 -0
  110. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/872ba8af52a8c1380c388bab0e20bec2e729db80 +1 -0
  111. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/8855f2d904cf1bbaffc54e68d98890fdc9ec14cc +0 -0
  112. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/8a22f56ee86cc2d67e9610a6b0ed59f21008a341 +0 -0
  113. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/935a69e9f3bfa1dd3bf058fa3e1b953e82195de6 +1 -0
  114. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/951ccb49640c8f9e81fb4e0d82730321f4e15bb3 +0 -0
  115. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/9af1f3ed10c7a54f6b57c344015141cc082db23b +0 -0
  116. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a0b7dd1684089c63a4aac2e4a832544df4d639d6 +0 -0
  117. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a22d0d3565a509a4bfedce078090d8c6a908d950 +0 -0
  118. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a22f1185582f66227118c8e9002a5c29728f0650 +0 -0
  119. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a457945cb86ec812235f407ed70fe72fbaf694a1 +1 -0
  120. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a4ee44c4e8728d4924642ef8765063262e8c4601 +0 -0
  121. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a4fc609a6546fc0061f499f0faed9054fd388c9a +1 -0
  122. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a7c13e6fe60eee08b9aac00a095a9301ea1a9824 +1 -0
  123. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/a98e22a5a8c2f5dda365d55e76536931010e1560 +0 -0
  124. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/aca6ed86348b1176bfbe4ebf32b2d48a0aa42f9f +0 -0
  125. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/aeefb82d7f5cc69168aade3b196a84d0f5c14bf2 +0 -0
  126. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/b37e0f6fa42840c773747c4cb608c278ab65021d +1 -0
  127. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/b5d4e67f0ec5b1a90100d8ad424d77aea8e16353 +0 -0
  128. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/b65ea16ba4dae8599ebbad7c4cb9fcd505edf485 +0 -0
  129. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/b95311782071c4d9182c0effe32487fc5cdbd33d +1 -0
  130. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/bbcaf4d15f92bfc6d624eee967fade1a74329f30 +0 -0
  131. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/bc26b8c794ac0adf948cbca02e88b3901824ef17 +1 -0
  132. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/bc7b23c2c68e4ad33ecea493ff6e60d423371cd0 +1 -0
  133. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/bd8daf3e78d8ba3a25838053b6993edc7a21c30e +0 -0
  134. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/c4d94647e646f02da1736b3179804ad6083acde9 +0 -0
  135. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/c869b259f9f81bec8ed24a9bc2cef35a513fb9fc +0 -0
  136. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/ceee46f04a09ef5d3342ef25d9f483e861727575 +1 -0
  137. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/d05c069216b54f35bc7e3ee08371baee243c089a +0 -0
  138. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/d18c30ba21e0d085dd983ad528f2c9001285d3d2 +1 -0
  139. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/d2c00146b2f2bcb4c6cecb731d2062273523d8c8 +1 -0
  140. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/d9bc7157a485958a5fce35ce777f551fe3f7d94c +0 -0
  141. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/defce76f0d3c3e057bb623986bacee7bbd07d1a1 +1 -0
  142. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/df9b696736847e43672b7a99ca05655af8a81135 +0 -0
  143. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/e5b420f71cf412bd9fdebdd46245fabd1f3462e5 +1 -0
  144. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/e7979b0e6e3e9cd64ceab99778c55205d6f92a73 +0 -0
  145. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/ee629f1935abc05fdc32ba314ec1f80f4bff2a17 +0 -0
  146. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/f944dcd635f9801f7ac90a407fbc479964dec024 +0 -0
  147. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/fadcde7d914246ca04bd56e68fd4045b1cf1c5ef +0 -0
  148. package/third_party/boringssl/src/fuzz/der_roundtrip_corpus/fd8be6506a9995f626eef831b9c981a80b0e3640 +0 -0
  149. package/third_party/boringssl/src/include/openssl/cipher.h +21 -48
  150. package/third_party/boringssl/src/include/openssl/ssl.h +38 -0
  151. package/third_party/boringssl/src/ssl/handshake_client.cc +8 -2
  152. package/third_party/boringssl/src/ssl/internal.h +16 -3
  153. package/third_party/boringssl/src/ssl/s3_both.cc +23 -1
  154. package/third_party/boringssl/src/ssl/ssl_lib.cc +94 -1
  155. package/third_party/boringssl/src/ssl/test/runner/runner.go +192 -0
  156. package/third_party/boringssl/src/ssl/test/test_config.cc +6 -0
  157. package/third_party/boringssl/src/ssl/test/test_config.h +1 -0
  158. package/third_party/boringssl/src/ssl/tls13_client.cc +7 -3
  159. package/third_party/boringssl/src/ssl/tls13_server.cc +2 -1
  160. package/third_party/boringssl/src/util/convert_comments.go +23 -0
  161. package/third_party/boringssl/src/util/fipstools/acvp/acvptool/acvp/acvp.go +1 -1
  162. package/third_party/boringssl/src/util/fipstools/acvp/modulewrapper/modulewrapper.cc +32 -21
  163. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.cc +1 -1
  164. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.h +1 -1
  165. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_logging_impl.h +3 -2
  166. package/third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_test_impl.cc +2 -2
  167. package/third_party/quiche/quiche/http2/adapter/http2_protocol.h +5 -1
  168. package/third_party/quiche/quiche/http2/adapter/http2_util.cc +2 -0
  169. package/third_party/quiche/quiche/http2/adapter/http2_visitor_interface.h +2 -0
  170. package/third_party/quiche/quiche/http2/adapter/nghttp2_adapter_test.cc +119 -0
  171. package/third_party/quiche/quiche/http2/adapter/oghttp2_adapter_test.cc +130 -0
  172. package/third_party/quiche/quiche/http2/adapter/oghttp2_session.cc +23 -12
  173. package/third_party/quiche/quiche/http2/decoder/decode_buffer_test.cc +6 -11
  174. package/third_party/quiche/quiche/quic/core/congestion_control/bbr2_sender.cc +0 -5
  175. package/third_party/quiche/quiche/quic/core/congestion_control/bbr2_sender.h +0 -2
  176. package/third_party/quiche/quiche/quic/core/congestion_control/bbr_sender.cc +0 -10
  177. package/third_party/quiche/quiche/quic/core/congestion_control/bbr_sender.h +0 -1
  178. package/third_party/quiche/quiche/quic/core/congestion_control/send_algorithm_interface.h +0 -6
  179. package/third_party/quiche/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.cc +0 -2
  180. package/third_party/quiche/quiche/quic/core/congestion_control/tcp_cubic_sender_bytes.h +0 -1
  181. package/third_party/quiche/quiche/quic/core/crypto/transport_parameters_test.cc +1 -3
  182. package/third_party/quiche/quiche/quic/core/http/end_to_end_test.cc +19 -9
  183. package/third_party/quiche/quiche/quic/core/http/http_decoder_test.cc +6 -3
  184. package/third_party/quiche/quiche/quic/core/http/quic_server_session_base.cc +4 -16
  185. package/third_party/quiche/quiche/quic/core/http/quic_spdy_session.h +6 -6
  186. package/third_party/quiche/quiche/quic/core/http/quic_spdy_session_test.cc +25 -15
  187. package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream_test.cc +6 -5
  188. package/third_party/quiche/quiche/quic/core/http/web_transport_http3.cc +1 -2
  189. package/third_party/quiche/quiche/quic/core/quic_bandwidth_test.cc +12 -12
  190. package/third_party/quiche/quiche/quic/core/quic_connection.cc +5 -95
  191. package/third_party/quiche/quiche/quic/core/quic_connection.h +0 -35
  192. package/third_party/quiche/quiche/quic/core/quic_connection_test.cc +80 -196
  193. package/third_party/quiche/quiche/quic/core/quic_control_frame_manager.cc +1 -1
  194. package/third_party/quiche/quiche/quic/core/quic_crypto_stream.cc +29 -5
  195. package/third_party/quiche/quiche/quic/core/quic_crypto_stream_test.cc +46 -0
  196. package/third_party/quiche/quiche/quic/core/quic_dispatcher_test.cc +17 -14
  197. package/third_party/quiche/quiche/quic/core/quic_flags_list.h +54 -54
  198. package/third_party/quiche/quiche/quic/core/quic_flow_controller_test.cc +8 -5
  199. package/third_party/quiche/quiche/quic/core/quic_framer_test.cc +8 -5
  200. package/third_party/quiche/quiche/quic/core/quic_idle_network_detector.cc +1 -0
  201. package/third_party/quiche/quiche/quic/core/quic_idle_network_detector_test.cc +29 -0
  202. package/third_party/quiche/quiche/quic/core/quic_packet_creator.cc +1 -5
  203. package/third_party/quiche/quiche/quic/core/quic_packet_creator_test.cc +18 -11
  204. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.cc +9 -28
  205. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.h +0 -13
  206. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager_test.cc +1 -49
  207. package/third_party/quiche/quiche/quic/core/quic_session.cc +0 -8
  208. package/third_party/quiche/quiche/quic/core/quic_session.h +0 -1
  209. package/third_party/quiche/quiche/quic/core/quic_stream.cc +1 -1
  210. package/third_party/quiche/quiche/quic/core/quic_stream_sequencer.cc +5 -0
  211. package/third_party/quiche/quiche/quic/core/quic_stream_sequencer.h +4 -0
  212. package/third_party/quiche/quiche/quic/core/quic_stream_sequencer_test.cc +12 -5
  213. package/third_party/quiche/quiche/quic/core/quic_stream_test.cc +27 -12
  214. package/third_party/quiche/quiche/quic/core/quic_types.cc +0 -1
  215. package/third_party/quiche/quiche/quic/core/quic_types.h +0 -3
  216. package/third_party/quiche/quiche/quic/core/quic_utils.cc +0 -3
  217. package/third_party/quiche/quiche/quic/core/quic_utils_test.cc +0 -2
  218. package/third_party/quiche/quiche/quic/core/tls_client_handshaker_test.cc +16 -12
  219. package/third_party/quiche/quiche/quic/core/tls_handshaker.cc +18 -3
  220. package/third_party/quiche/quiche/quic/qbone/platform/internet_checksum.cc +7 -2
  221. package/third_party/quiche/quiche/quic/test_tools/crypto_test_utils.cc +20 -12
  222. package/third_party/quiche/quiche/quic/test_tools/crypto_test_utils.h +10 -5
  223. package/third_party/quiche/quiche/quic/test_tools/quic_test_utils.h +0 -2
  224. package/third_party/quiche/quiche/quic/test_tools/simulator/quic_endpoint.cc +0 -8
  225. package/third_party/quiche/quiche/quic/test_tools/simulator/quic_endpoint.h +0 -1
  226. package/third_party/quiche/quiche/quic/tools/quic_simple_server_stream_test.cc +2 -1
  227. package/platform/net/quiche/common/platform/impl/quic_flags_list_add.h +0 -379
  228. package/platform/net/quiche/common/platform/impl/quiche_flags_impl.cc +0 -21
  229. package/third_party/boringssl/src/crypto/asn1/charmap.h +0 -15
  230. package/third_party/boringssl/src/crypto/asn1/charmap.pl +0 -135
@@ -502,7 +502,6 @@ class TestConnection : public QuicConnection {
502
502
  using QuicConnection::active_effective_peer_migration_type;
503
503
  using QuicConnection::IsCurrentPacketConnectivityProbing;
504
504
  using QuicConnection::SelectMutualVersion;
505
- using QuicConnection::SendProbingRetransmissions;
506
505
  using QuicConnection::set_defer_send_in_response_to_packets;
507
506
 
508
507
  protected:
@@ -6958,14 +6957,19 @@ TEST_P(QuicConnectionTest, SendingUnencryptedStreamDataFails) {
6958
6957
  return;
6959
6958
  }
6960
6959
 
6961
- EXPECT_CALL(visitor_, OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF))
6962
- .WillOnce(Invoke(this, &QuicConnectionTest::SaveConnectionCloseFrame));
6963
- EXPECT_QUIC_BUG(connection_.SaveAndSendStreamData(3, {}, 0, FIN),
6964
- "Cannot send stream data with level: ENCRYPTION_INITIAL");
6965
- EXPECT_FALSE(connection_.connected());
6966
- EXPECT_EQ(1, connection_close_frame_count_);
6967
- EXPECT_THAT(saved_connection_close_frame_.quic_error_code,
6968
- IsError(QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA));
6960
+ EXPECT_QUIC_BUG(
6961
+ {
6962
+ EXPECT_CALL(visitor_,
6963
+ OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF))
6964
+ .WillOnce(
6965
+ Invoke(this, &QuicConnectionTest::SaveConnectionCloseFrame));
6966
+ connection_.SaveAndSendStreamData(3, {}, 0, FIN);
6967
+ EXPECT_FALSE(connection_.connected());
6968
+ EXPECT_EQ(1, connection_close_frame_count_);
6969
+ EXPECT_THAT(saved_connection_close_frame_.quic_error_code,
6970
+ IsError(QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA));
6971
+ },
6972
+ "Cannot send stream data with level: ENCRYPTION_INITIAL");
6969
6973
  }
6970
6974
 
6971
6975
  TEST_P(QuicConnectionTest, SetRetransmissionAlarmForCryptoPacket) {
@@ -7648,57 +7652,6 @@ TEST_P(QuicConnectionTest, NotBecomeApplicationLimitedDueToWriteBlock) {
7648
7652
  connection_.OnCanWrite();
7649
7653
  }
7650
7654
 
7651
- // Test the mode in which the link is filled up with probing retransmissions if
7652
- // the connection becomes application-limited.
7653
- TEST_P(QuicConnectionTest, SendDataWhenApplicationLimited) {
7654
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
7655
- EXPECT_CALL(*send_algorithm_, ShouldSendProbingPacket())
7656
- .WillRepeatedly(Return(true));
7657
- {
7658
- InSequence seq;
7659
- EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true));
7660
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
7661
- EXPECT_CALL(visitor_, WillingAndAbleToWrite())
7662
- .WillRepeatedly(Return(false));
7663
- }
7664
- EXPECT_CALL(visitor_, SendProbingData()).WillRepeatedly([this] {
7665
- return connection_.sent_packet_manager().MaybeRetransmitOldestPacket(
7666
- PROBING_RETRANSMISSION);
7667
- });
7668
- // Fix congestion window to be 20,000 bytes.
7669
- EXPECT_CALL(*send_algorithm_, CanSend(Ge(20000u)))
7670
- .WillRepeatedly(Return(false));
7671
- EXPECT_CALL(*send_algorithm_, CanSend(Lt(20000u)))
7672
- .WillRepeatedly(Return(true));
7673
-
7674
- EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(0);
7675
- ASSERT_EQ(0u, connection_.GetStats().packets_sent);
7676
- connection_.set_fill_up_link_during_probing(true);
7677
- EXPECT_CALL(visitor_, GetHandshakeState())
7678
- .WillRepeatedly(Return(HANDSHAKE_CONFIRMED));
7679
- connection_.OnHandshakeComplete();
7680
- connection_.SendStreamData3();
7681
-
7682
- // We expect a lot of packets from a 20 kbyte window.
7683
- EXPECT_GT(connection_.GetStats().packets_sent, 10u);
7684
- // Ensure that the packets are padded.
7685
- QuicByteCount average_packet_size =
7686
- connection_.GetStats().bytes_sent / connection_.GetStats().packets_sent;
7687
- EXPECT_GT(average_packet_size, 1000u);
7688
-
7689
- // Acknowledge all packets sent, except for the last one.
7690
- QuicAckFrame ack = InitAckFrame(
7691
- connection_.sent_packet_manager().GetLargestSentPacket() - 1);
7692
- EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _, _));
7693
- EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _));
7694
-
7695
- // Ensure that since we no longer have retransmittable bytes in flight, this
7696
- // will not cause any responses to be sent.
7697
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0);
7698
- EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(1);
7699
- ProcessAckPacket(&ack);
7700
- }
7701
-
7702
7655
  TEST_P(QuicConnectionTest, DoNotForceSendingAckOnPacketTooLarge) {
7703
7656
  EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
7704
7657
  // Send an ack by simulating delayed ack alarm firing.
@@ -7839,83 +7792,6 @@ TEST_P(QuicConnectionTest, ClientAlwaysSendConnectionId) {
7839
7792
  writer_->last_packet_header().destination_connection_id_included);
7840
7793
  }
7841
7794
 
7842
- TEST_P(QuicConnectionTest, SendProbingRetransmissions) {
7843
- MockQuicConnectionDebugVisitor debug_visitor;
7844
- connection_.set_debug_visitor(&debug_visitor);
7845
-
7846
- const QuicStreamId stream_id = 2;
7847
- QuicPacketNumber last_packet;
7848
- SendStreamDataToPeer(stream_id, "foo", 0, NO_FIN, &last_packet);
7849
- SendStreamDataToPeer(stream_id, "bar", 3, NO_FIN, &last_packet);
7850
- SendStreamDataToPeer(stream_id, "test", 6, NO_FIN, &last_packet);
7851
-
7852
- const QuicByteCount old_bytes_in_flight =
7853
- connection_.sent_packet_manager().GetBytesInFlight();
7854
-
7855
- // Allow 9 probing retransmissions to be sent.
7856
- {
7857
- InSequence seq;
7858
- EXPECT_CALL(*send_algorithm_, CanSend(_))
7859
- .Times(9 * 2)
7860
- .WillRepeatedly(Return(true));
7861
- EXPECT_CALL(*send_algorithm_, CanSend(_)).WillOnce(Return(false));
7862
- }
7863
- // Expect them retransmitted in cyclic order (foo, bar, test, foo, bar...).
7864
- QuicPacketCount sent_count = 0;
7865
-
7866
- EXPECT_CALL(debug_visitor, OnPacketSent(_, _, _, _, _, _, _, _))
7867
- .WillRepeatedly(Invoke(
7868
- [this, &sent_count](QuicPacketNumber, QuicPacketLength, bool,
7869
- TransmissionType, EncryptionLevel,
7870
- const QuicFrames&, const QuicFrames&, QuicTime) {
7871
- ASSERT_EQ(1u, writer_->stream_frames().size());
7872
- if (connection_.version().CanSendCoalescedPackets()) {
7873
- // There is a delay of sending coalesced packet, so (6, 0, 3, 6,
7874
- // 0...).
7875
- EXPECT_EQ(3 * ((sent_count + 2) % 3),
7876
- writer_->stream_frames()[0]->offset);
7877
- } else {
7878
- // Identify the frames by stream offset (0, 3, 6, 0, 3...).
7879
- EXPECT_EQ(3 * (sent_count % 3),
7880
- writer_->stream_frames()[0]->offset);
7881
- }
7882
- sent_count++;
7883
- }));
7884
-
7885
- EXPECT_CALL(*send_algorithm_, ShouldSendProbingPacket())
7886
- .WillRepeatedly(Return(true));
7887
- EXPECT_CALL(visitor_, SendProbingData()).WillRepeatedly([this] {
7888
- return connection_.sent_packet_manager().MaybeRetransmitOldestPacket(
7889
- PROBING_RETRANSMISSION);
7890
- });
7891
-
7892
- connection_.SendProbingRetransmissions();
7893
-
7894
- // Ensure that the in-flight has increased.
7895
- const QuicByteCount new_bytes_in_flight =
7896
- connection_.sent_packet_manager().GetBytesInFlight();
7897
- EXPECT_GT(new_bytes_in_flight, old_bytes_in_flight);
7898
- }
7899
-
7900
- // Ensure that SendProbingRetransmissions() does not retransmit anything when
7901
- // there are no outstanding packets.
7902
- TEST_P(QuicConnectionTest,
7903
- SendProbingRetransmissionsFailsWhenNothingToRetransmit) {
7904
- ASSERT_TRUE(connection_.sent_packet_manager().unacked_packets().empty());
7905
-
7906
- MockQuicConnectionDebugVisitor debug_visitor;
7907
- connection_.set_debug_visitor(&debug_visitor);
7908
- EXPECT_CALL(debug_visitor, OnPacketSent(_, _, _, _, _, _, _, _)).Times(0);
7909
- EXPECT_CALL(*send_algorithm_, ShouldSendProbingPacket())
7910
- .WillRepeatedly(Return(true));
7911
- EXPECT_CALL(visitor_, SendProbingData()).WillRepeatedly([this] {
7912
- return connection_.sent_packet_manager().MaybeRetransmitOldestPacket(
7913
- PROBING_RETRANSMISSION);
7914
- });
7915
-
7916
- connection_.SendProbingRetransmissions();
7917
- }
7918
-
7919
7795
  TEST_P(QuicConnectionTest, PingAfterLastRetransmittablePacketAcked) {
7920
7796
  const QuicTime::Delta retransmittable_on_wire_timeout =
7921
7797
  QuicTime::Delta::FromMilliseconds(50);
@@ -9905,60 +9781,65 @@ TEST_P(QuicConnectionTest, FailToCoalescePacket) {
9905
9781
  set_perspective(Perspective::IS_SERVER);
9906
9782
  use_tagging_decrypter();
9907
9783
 
9908
- EXPECT_CALL(visitor_, OnHandshakePacketSent());
9909
-
9910
- EXPECT_CALL(visitor_, OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF))
9911
- .WillOnce(Invoke(this, &QuicConnectionTest::SaveConnectionCloseFrame));
9912
-
9913
- ProcessDataPacketAtLevel(1, !kHasStopWaiting, ENCRYPTION_INITIAL);
9914
9784
  auto test_body = [&] {
9915
- QuicConnection::ScopedPacketFlusher flusher(&connection_);
9916
- connection_.SetEncrypter(ENCRYPTION_INITIAL,
9917
- std::make_unique<TaggingEncrypter>(0x01));
9918
- connection_.SetDefaultEncryptionLevel(ENCRYPTION_INITIAL);
9919
- connection_.SendCryptoDataWithString("foo", 0);
9920
- // Verify this packet is on hold.
9921
- EXPECT_EQ(0u, writer_->packets_write_attempts());
9785
+ EXPECT_CALL(visitor_, OnHandshakePacketSent());
9922
9786
 
9923
- connection_.SetEncrypter(ENCRYPTION_HANDSHAKE,
9924
- std::make_unique<TaggingEncrypter>(0x02));
9925
- connection_.SetDefaultEncryptionLevel(ENCRYPTION_HANDSHAKE);
9926
- connection_.SendCryptoDataWithString("bar", 3);
9927
- EXPECT_EQ(0u, writer_->packets_write_attempts());
9787
+ EXPECT_CALL(visitor_,
9788
+ OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF))
9789
+ .WillOnce(Invoke(this, &QuicConnectionTest::SaveConnectionCloseFrame));
9928
9790
 
9929
- connection_.SetEncrypter(ENCRYPTION_FORWARD_SECURE,
9930
- std::make_unique<TaggingEncrypter>(0x03));
9931
- connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
9932
- SendStreamDataToPeer(2, "baz", 3, NO_FIN, nullptr);
9791
+ ProcessDataPacketAtLevel(1, !kHasStopWaiting, ENCRYPTION_INITIAL);
9933
9792
 
9934
- creator_->Flush();
9935
-
9936
- auto& coalesced_packet =
9937
- QuicConnectionPeer::GetCoalescedPacket(&connection_);
9938
- QuicPacketLength coalesced_packet_max_length =
9939
- coalesced_packet.max_packet_length();
9940
- QuicCoalescedPacketPeer::SetMaxPacketLength(coalesced_packet,
9941
- coalesced_packet.length());
9942
-
9943
- // Make the coalescer's FORWARD_SECURE packet longer.
9944
- *QuicCoalescedPacketPeer::GetMutableEncryptedBuffer(
9945
- coalesced_packet, ENCRYPTION_FORWARD_SECURE) += "!!! TEST !!!";
9946
-
9947
- QUIC_LOG(INFO) << "Reduced coalesced_packet_max_length from "
9948
- << coalesced_packet_max_length << " to "
9949
- << coalesced_packet.max_packet_length()
9950
- << ", coalesced_packet.length:" << coalesced_packet.length()
9951
- << ", coalesced_packet.packet_lengths:"
9952
- << absl::StrJoin(coalesced_packet.packet_lengths(), ":");
9793
+ {
9794
+ QuicConnection::ScopedPacketFlusher flusher(&connection_);
9795
+ connection_.SetEncrypter(ENCRYPTION_INITIAL,
9796
+ std::make_unique<TaggingEncrypter>(0x01));
9797
+ connection_.SetDefaultEncryptionLevel(ENCRYPTION_INITIAL);
9798
+ connection_.SendCryptoDataWithString("foo", 0);
9799
+ // Verify this packet is on hold.
9800
+ EXPECT_EQ(0u, writer_->packets_write_attempts());
9801
+
9802
+ connection_.SetEncrypter(ENCRYPTION_HANDSHAKE,
9803
+ std::make_unique<TaggingEncrypter>(0x02));
9804
+ connection_.SetDefaultEncryptionLevel(ENCRYPTION_HANDSHAKE);
9805
+ connection_.SendCryptoDataWithString("bar", 3);
9806
+ EXPECT_EQ(0u, writer_->packets_write_attempts());
9807
+
9808
+ connection_.SetEncrypter(ENCRYPTION_FORWARD_SECURE,
9809
+ std::make_unique<TaggingEncrypter>(0x03));
9810
+ connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
9811
+ SendStreamDataToPeer(2, "baz", 3, NO_FIN, nullptr);
9812
+
9813
+ creator_->Flush();
9814
+
9815
+ auto& coalesced_packet =
9816
+ QuicConnectionPeer::GetCoalescedPacket(&connection_);
9817
+ QuicPacketLength coalesced_packet_max_length =
9818
+ coalesced_packet.max_packet_length();
9819
+ QuicCoalescedPacketPeer::SetMaxPacketLength(coalesced_packet,
9820
+ coalesced_packet.length());
9821
+
9822
+ // Make the coalescer's FORWARD_SECURE packet longer.
9823
+ *QuicCoalescedPacketPeer::GetMutableEncryptedBuffer(
9824
+ coalesced_packet, ENCRYPTION_FORWARD_SECURE) += "!!! TEST !!!";
9825
+
9826
+ QUIC_LOG(INFO) << "Reduced coalesced_packet_max_length from "
9827
+ << coalesced_packet_max_length << " to "
9828
+ << coalesced_packet.max_packet_length()
9829
+ << ", coalesced_packet.length:"
9830
+ << coalesced_packet.length()
9831
+ << ", coalesced_packet.packet_lengths:"
9832
+ << absl::StrJoin(coalesced_packet.packet_lengths(), ":");
9833
+ }
9834
+
9835
+ EXPECT_FALSE(connection_.connected());
9836
+ EXPECT_THAT(saved_connection_close_frame_.quic_error_code,
9837
+ IsError(QUIC_FAILED_TO_SERIALIZE_PACKET));
9838
+ EXPECT_EQ(saved_connection_close_frame_.error_details,
9839
+ "Failed to serialize coalesced packet.");
9953
9840
  };
9954
9841
 
9955
9842
  EXPECT_QUIC_BUG(test_body(), "SerializeCoalescedPacket failed.");
9956
-
9957
- EXPECT_FALSE(connection_.connected());
9958
- EXPECT_THAT(saved_connection_close_frame_.quic_error_code,
9959
- IsError(QUIC_FAILED_TO_SERIALIZE_PACKET));
9960
- EXPECT_EQ(saved_connection_close_frame_.error_details,
9961
- "Failed to serialize coalesced packet.");
9962
9843
  }
9963
9844
 
9964
9845
  TEST_P(QuicConnectionTest, LegacyVersionEncapsulation) {
@@ -14515,21 +14396,24 @@ TEST_P(QuicConnectionTest, LostDataThenGetAcknowledged) {
14515
14396
  QuicAckFrame ack = InitAckFrame({{QuicPacketNumber(1), QuicPacketNumber(5)}});
14516
14397
  frames.push_back(QuicFrame(&ack));
14517
14398
 
14518
- EXPECT_CALL(visitor_, OnConnectionMigration(_)).Times(1);
14519
-
14520
14399
  // Invoke OnCanWrite.
14521
- EXPECT_CALL(visitor_, OnStreamFrame(_))
14522
- .WillOnce(
14523
- InvokeWithoutArgs(&notifier_, &SimpleSessionNotifier::OnCanWrite));
14524
14400
  QuicIpAddress ip_address;
14525
14401
  ASSERT_TRUE(ip_address.FromString("127.0.52.223"));
14526
- EXPECT_QUIC_BUG(ProcessFramesPacketWithAddresses(
14527
- frames, kSelfAddress, QuicSocketAddress(ip_address, 1000),
14528
- ENCRYPTION_FORWARD_SECURE),
14529
- "Try to write mid packet processing");
14530
- EXPECT_EQ(1u, writer_->path_challenge_frames().size());
14531
- // Verify stream frame will not be retransmitted.
14532
- EXPECT_TRUE(writer_->stream_frames().empty());
14402
+ EXPECT_QUIC_BUG(
14403
+ {
14404
+ EXPECT_CALL(visitor_, OnConnectionMigration(_)).Times(1);
14405
+ EXPECT_CALL(visitor_, OnStreamFrame(_))
14406
+ .WillOnce(InvokeWithoutArgs(&notifier_,
14407
+ &SimpleSessionNotifier::OnCanWrite));
14408
+ ProcessFramesPacketWithAddresses(frames, kSelfAddress,
14409
+ QuicSocketAddress(ip_address, 1000),
14410
+ ENCRYPTION_FORWARD_SECURE);
14411
+ EXPECT_EQ(1u, writer_->path_challenge_frames().size());
14412
+
14413
+ // Verify stream frame will not be retransmitted.
14414
+ EXPECT_TRUE(writer_->stream_frames().empty());
14415
+ },
14416
+ "Try to write mid packet processing");
14533
14417
  }
14534
14418
 
14535
14419
  TEST_P(QuicConnectionTest, PtoSendStreamData) {
@@ -274,7 +274,7 @@ void QuicControlFrameManager::OnCanWrite() {
274
274
 
275
275
  bool QuicControlFrameManager::RetransmitControlFrame(const QuicFrame& frame,
276
276
  TransmissionType type) {
277
- QUICHE_DCHECK(type == PTO_RETRANSMISSION || type == PROBING_RETRANSMISSION);
277
+ QUICHE_DCHECK(type == PTO_RETRANSMISSION);
278
278
  QuicControlFrameId id = GetControlFrameId(frame);
279
279
  if (id == kInvalidControlFrameId) {
280
280
  // Frame does not have a valid control frame ID, ignore it. Returns true
@@ -13,6 +13,7 @@
13
13
  #include "quiche/quic/core/crypto/crypto_utils.h"
14
14
  #include "quiche/quic/core/frames/quic_crypto_frame.h"
15
15
  #include "quiche/quic/core/quic_connection.h"
16
+ #include "quiche/quic/core/quic_error_codes.h"
16
17
  #include "quiche/quic/core/quic_session.h"
17
18
  #include "quiche/quic/core/quic_types.h"
18
19
  #include "quiche/quic/core/quic_utils.h"
@@ -145,17 +146,41 @@ void QuicCryptoStream::WriteCryptoData(EncryptionLevel level,
145
146
  return;
146
147
  }
147
148
  const bool had_buffered_data = HasBufferedCryptoFrames();
148
- // Append |data| to the send buffer for this encryption level.
149
149
  QuicStreamSendBuffer* send_buffer =
150
150
  &substreams_[QuicUtils::GetPacketNumberSpace(level)].send_buffer;
151
151
  QuicStreamOffset offset = send_buffer->stream_offset();
152
+
153
+ // Ensure this data does not cause the send buffer for this encryption level
154
+ // to exceed its size limit.
155
+ if (GetQuicReloadableFlag(quic_bounded_crypto_send_buffer)) {
156
+ QUIC_RELOADABLE_FLAG_COUNT(quic_bounded_crypto_send_buffer);
157
+ QUIC_BUG_IF(quic_crypto_stream_offset_lt_bytes_written,
158
+ offset < send_buffer->stream_bytes_written());
159
+ uint64_t current_buffer_size =
160
+ offset - std::min(offset, send_buffer->stream_bytes_written());
161
+ if (current_buffer_size > 0) {
162
+ QUIC_CODE_COUNT(quic_received_crypto_data_with_non_empty_send_buffer);
163
+ if (BufferSizeLimitForLevel(level) <
164
+ (current_buffer_size + data.length())) {
165
+ QUIC_BUG(quic_crypto_send_buffer_overflow)
166
+ << absl::StrCat("Too much data for crypto send buffer with level: ",
167
+ EncryptionLevelToString(level),
168
+ ", current_buffer_size: ", current_buffer_size,
169
+ ", data length: ", data.length());
170
+ OnUnrecoverableError(QUIC_INTERNAL_ERROR,
171
+ "Too much data for crypto send buffer");
172
+ return;
173
+ }
174
+ }
175
+ }
176
+
177
+ // Append |data| to the send buffer for this encryption level.
152
178
  send_buffer->SaveStreamData(data);
153
179
  if (kMaxStreamLength - offset < data.length()) {
154
180
  QUIC_BUG(quic_bug_10322_2) << "Writing too much crypto handshake data";
155
- // TODO(nharper): Switch this to an IETF QUIC error code, possibly
156
- // INTERNAL_ERROR?
157
- OnUnrecoverableError(QUIC_STREAM_LENGTH_OVERFLOW,
181
+ OnUnrecoverableError(QUIC_INTERNAL_ERROR,
158
182
  "Writing too much crypto handshake data");
183
+ return;
159
184
  }
160
185
  if (had_buffered_data) {
161
186
  // Do not try to write if there is buffered data.
@@ -228,7 +253,6 @@ void QuicCryptoStream::OnStreamDataConsumed(QuicByteCount bytes_consumed) {
228
253
  QuicStream::OnStreamDataConsumed(bytes_consumed);
229
254
  }
230
255
 
231
-
232
256
  bool QuicCryptoStream::HasPendingCryptoRetransmission() const {
233
257
  if (!QuicVersionUsesCryptoFrames(session()->transport_version())) {
234
258
  return false;
@@ -13,8 +13,10 @@
13
13
  #include "quiche/quic/core/crypto/crypto_handshake.h"
14
14
  #include "quiche/quic/core/crypto/crypto_protocol.h"
15
15
  #include "quiche/quic/core/crypto/null_encrypter.h"
16
+ #include "quiche/quic/core/quic_error_codes.h"
16
17
  #include "quiche/quic/core/quic_types.h"
17
18
  #include "quiche/quic/core/quic_utils.h"
19
+ #include "quiche/quic/platform/api/quic_expect_bug.h"
18
20
  #include "quiche/quic/platform/api/quic_socket_address.h"
19
21
  #include "quiche/quic/platform/api/quic_test.h"
20
22
  #include "quiche/quic/test_tools/crypto_test_utils.h"
@@ -652,6 +654,50 @@ TEST_F(QuicCryptoStreamTest, CryptoMessageFramingOverhead) {
652
654
  }
653
655
  }
654
656
 
657
+ TEST_F(QuicCryptoStreamTest, WriteCryptoDataExceedsSendBufferLimit) {
658
+ if (!QuicVersionUsesCryptoFrames(connection_->transport_version())) {
659
+ return;
660
+ }
661
+ EXPECT_EQ(ENCRYPTION_INITIAL, connection_->encryption_level());
662
+ int32_t buffer_limit = GetQuicFlag(FLAGS_quic_max_buffered_crypto_bytes);
663
+
664
+ // Write data larger than the buffer limit, when there is no existing data in
665
+ // the buffer. Data is sent rather than closing the connection.
666
+ EXPECT_FALSE(stream_->HasBufferedCryptoFrames());
667
+ int32_t over_limit = buffer_limit + 1;
668
+ EXPECT_CALL(*connection_, SendCryptoData(ENCRYPTION_INITIAL, over_limit, 0))
669
+ // All the data is sent, no resulting buffer.
670
+ .WillOnce(Return(over_limit));
671
+ std::string large_data(over_limit, 'a');
672
+ stream_->WriteCryptoData(ENCRYPTION_INITIAL, large_data);
673
+
674
+ // Write data to the buffer up to the limit. One byte gets sent.
675
+ EXPECT_FALSE(stream_->HasBufferedCryptoFrames());
676
+ EXPECT_CALL(*connection_,
677
+ SendCryptoData(ENCRYPTION_INITIAL, buffer_limit, over_limit))
678
+ .WillOnce(Return(1));
679
+ std::string data(buffer_limit, 'a');
680
+ stream_->WriteCryptoData(ENCRYPTION_INITIAL, data);
681
+ EXPECT_TRUE(stream_->HasBufferedCryptoFrames());
682
+
683
+ // Write another byte that is not sent (due to there already being data in the
684
+ // buffer); send buffer is now full.
685
+ EXPECT_CALL(*connection_, SendCryptoData(_, _, _)).Times(0);
686
+ std::string data2(1, 'a');
687
+ stream_->WriteCryptoData(ENCRYPTION_INITIAL, data2);
688
+ EXPECT_TRUE(stream_->HasBufferedCryptoFrames());
689
+
690
+ // Writing an additional byte to the send buffer closes the connection.
691
+ if (GetQuicReloadableFlag(quic_bounded_crypto_send_buffer)) {
692
+ QUIC_RELOADABLE_FLAG_COUNT(quic_bounded_crypto_send_buffer);
693
+ EXPECT_CALL(*connection_, CloseConnection(QUIC_INTERNAL_ERROR, _, _));
694
+ EXPECT_QUIC_BUG(
695
+ stream_->WriteCryptoData(ENCRYPTION_INITIAL, data2),
696
+ "Too much data for crypto send buffer with level: ENCRYPTION_INITIAL, "
697
+ "current_buffer_size: 16384, data length: 1");
698
+ }
699
+ }
700
+
655
701
  TEST_F(QuicCryptoStreamTest, WriteBufferedCryptoFrames) {
656
702
  if (!QuicVersionUsesCryptoFrames(connection_->transport_version())) {
657
703
  return;
@@ -2162,20 +2162,23 @@ TEST_P(QuicDispatcherWriteBlockedListTest, PerConnectionWriterBlocked) {
2162
2162
 
2163
2163
  TEST_P(QuicDispatcherWriteBlockedListTest,
2164
2164
  RemoveConnectionFromWriteBlockedListWhenDeletingSessions) {
2165
- dispatcher_->OnConnectionClosed(connection1()->connection_id(),
2166
- QUIC_PACKET_WRITE_ERROR, "Closed by test.",
2167
- ConnectionCloseSource::FROM_SELF);
2168
-
2169
- SetBlocked();
2170
-
2171
- ASSERT_FALSE(dispatcher_->HasPendingWrites());
2172
- SetBlocked();
2173
- dispatcher_->OnWriteBlocked(connection1());
2174
- ASSERT_TRUE(dispatcher_->HasPendingWrites());
2175
-
2176
- EXPECT_QUIC_BUG(dispatcher_->DeleteSessions(),
2177
- "QuicConnection was in WriteBlockedList before destruction");
2178
- MarkSession1Deleted();
2165
+ EXPECT_QUIC_BUG(
2166
+ {
2167
+ dispatcher_->OnConnectionClosed(
2168
+ connection1()->connection_id(), QUIC_PACKET_WRITE_ERROR,
2169
+ "Closed by test.", ConnectionCloseSource::FROM_SELF);
2170
+
2171
+ SetBlocked();
2172
+
2173
+ ASSERT_FALSE(dispatcher_->HasPendingWrites());
2174
+ SetBlocked();
2175
+ dispatcher_->OnWriteBlocked(connection1());
2176
+ ASSERT_TRUE(dispatcher_->HasPendingWrites());
2177
+
2178
+ dispatcher_->DeleteSessions();
2179
+ MarkSession1Deleted();
2180
+ },
2181
+ "QuicConnection was in WriteBlockedList before destruction");
2179
2182
  }
2180
2183
 
2181
2184
  class QuicDispatcherSupportMultipleConnectionIdPerConnectionTest