@fails-components/webtransport 0.0.1 → 0.0.2

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 (300) hide show
  1. package/package.json +1 -1
  2. package/readme.md +1 -3
  3. package/src/http3eventloop.cc +83 -9
  4. package/src/http3eventloop.h +13 -3
  5. package/src/http3server.cc +22 -22
  6. package/src/http3server.h +7 -20
  7. package/src/http3wtstreamvisitor.cc +31 -10
  8. package/src/http3wtstreamvisitor.h +38 -11
  9. package/src/webtransport.js +91 -23
  10. package/test/echoserver.js +29 -5
  11. package/test/testsuite.js +242 -220
  12. package/third_party/boringssl/src/CMakeLists.txt +2 -0
  13. package/third_party/boringssl/src/crypto/CMakeLists.txt +1 -0
  14. package/third_party/boringssl/src/crypto/asn1/a_bitstr.c +174 -177
  15. package/third_party/boringssl/src/crypto/asn1/a_bool.c +46 -48
  16. package/third_party/boringssl/src/crypto/asn1/a_d2i_fp.c +21 -23
  17. package/third_party/boringssl/src/crypto/asn1/a_dup.c +21 -23
  18. package/third_party/boringssl/src/crypto/asn1/a_gentm.c +84 -187
  19. package/third_party/boringssl/src/crypto/asn1/a_i2d_fp.c +19 -21
  20. package/third_party/boringssl/src/crypto/asn1/a_int.c +305 -329
  21. package/third_party/boringssl/src/crypto/asn1/a_mbstr.c +190 -195
  22. package/third_party/boringssl/src/crypto/asn1/a_object.c +182 -189
  23. package/third_party/boringssl/src/crypto/asn1/a_octet.c +6 -9
  24. package/third_party/boringssl/src/crypto/asn1/a_print.c +15 -16
  25. package/third_party/boringssl/src/crypto/asn1/a_strex.c +386 -399
  26. package/third_party/boringssl/src/crypto/asn1/a_strnid.c +110 -131
  27. package/third_party/boringssl/src/crypto/asn1/a_time.c +118 -111
  28. package/third_party/boringssl/src/crypto/asn1/a_type.c +59 -60
  29. package/third_party/boringssl/src/crypto/asn1/a_utctm.c +114 -186
  30. package/third_party/boringssl/src/crypto/asn1/a_utf8.c +171 -159
  31. package/third_party/boringssl/src/crypto/asn1/asn1_lib.c +245 -260
  32. package/third_party/boringssl/src/crypto/asn1/asn1_par.c +41 -40
  33. package/third_party/boringssl/src/crypto/asn1/asn1_test.cc +31 -0
  34. package/third_party/boringssl/src/crypto/asn1/asn_pack.c +31 -33
  35. package/third_party/boringssl/src/crypto/asn1/f_int.c +36 -33
  36. package/third_party/boringssl/src/crypto/asn1/f_string.c +29 -26
  37. package/third_party/boringssl/src/crypto/asn1/internal.h +62 -61
  38. package/third_party/boringssl/src/crypto/asn1/tasn_dec.c +706 -702
  39. package/third_party/boringssl/src/crypto/asn1/tasn_enc.c +507 -524
  40. package/third_party/boringssl/src/crypto/asn1/tasn_fre.c +141 -133
  41. package/third_party/boringssl/src/crypto/asn1/tasn_new.c +207 -199
  42. package/third_party/boringssl/src/crypto/asn1/tasn_typ.c +19 -22
  43. package/third_party/boringssl/src/crypto/asn1/tasn_utl.c +24 -24
  44. package/third_party/boringssl/src/crypto/asn1/time_support.c +13 -13
  45. package/third_party/boringssl/src/crypto/bio/connect.c +9 -3
  46. package/third_party/boringssl/src/crypto/bytestring/bytestring_test.cc +125 -1
  47. package/third_party/boringssl/src/crypto/bytestring/cbb.c +4 -7
  48. package/third_party/boringssl/src/crypto/bytestring/cbs.c +167 -9
  49. package/third_party/boringssl/src/crypto/cipher_extra/e_aesctrhmac.c +0 -2
  50. package/third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c +23 -54
  51. package/third_party/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c +0 -2
  52. package/third_party/boringssl/src/crypto/cipher_extra/e_tls.c +0 -2
  53. package/third_party/boringssl/src/crypto/curve25519/curve25519.c +6 -8
  54. package/third_party/boringssl/src/crypto/evp/evp_ctx.c +25 -22
  55. package/third_party/boringssl/src/crypto/evp/internal.h +15 -9
  56. package/third_party/boringssl/src/crypto/evp/p_dsa_asn1.c +2 -0
  57. package/third_party/boringssl/src/crypto/evp/p_ec_asn1.c +2 -0
  58. package/third_party/boringssl/src/crypto/evp/p_ed25519.c +3 -3
  59. package/third_party/boringssl/src/crypto/evp/p_ed25519_asn1.c +10 -7
  60. package/third_party/boringssl/src/crypto/evp/p_hkdf.c +241 -0
  61. package/third_party/boringssl/src/crypto/evp/p_rsa_asn1.c +2 -0
  62. package/third_party/boringssl/src/crypto/evp/p_x25519_asn1.c +1 -0
  63. package/third_party/boringssl/src/crypto/fipsmodule/aes/aes_nohw.c +9 -10
  64. package/third_party/boringssl/src/crypto/fipsmodule/aes/key_wrap.c +2 -6
  65. package/third_party/boringssl/src/crypto/fipsmodule/bn/exponentiation.c +5 -11
  66. package/third_party/boringssl/src/crypto/fipsmodule/bn/internal.h +1 -1
  67. package/third_party/boringssl/src/crypto/fipsmodule/bn/prime.c +2 -0
  68. package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aes.c +10 -26
  69. package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aesccm.c +2 -3
  70. package/third_party/boringssl/src/crypto/fipsmodule/digestsign/digestsign.c +1 -0
  71. package/third_party/boringssl/src/crypto/fipsmodule/ec/p256-nistz.c +44 -43
  72. package/third_party/boringssl/src/crypto/fipsmodule/modes/cbc.c +5 -9
  73. package/third_party/boringssl/src/crypto/fipsmodule/modes/gcm.c +14 -21
  74. package/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c +8 -8
  75. package/third_party/boringssl/src/crypto/fipsmodule/rand/internal.h +1 -4
  76. package/third_party/boringssl/src/crypto/hkdf/hkdf_test.cc +104 -0
  77. package/third_party/boringssl/src/crypto/internal.h +18 -4
  78. package/third_party/boringssl/src/crypto/lhash/internal.h +13 -1
  79. package/third_party/boringssl/src/crypto/obj/obj_dat.h +4 -1
  80. package/third_party/boringssl/src/crypto/obj/obj_mac.num +1 -0
  81. package/third_party/boringssl/src/crypto/obj/objects.txt +2 -0
  82. package/third_party/boringssl/src/crypto/pem/pem_all.c +77 -86
  83. package/third_party/boringssl/src/crypto/pem/pem_info.c +221 -233
  84. package/third_party/boringssl/src/crypto/pem/pem_lib.c +639 -608
  85. package/third_party/boringssl/src/crypto/pem/pem_oth.c +17 -16
  86. package/third_party/boringssl/src/crypto/pem/pem_pk8.c +133 -142
  87. package/third_party/boringssl/src/crypto/pem/pem_pkey.c +96 -92
  88. package/third_party/boringssl/src/crypto/poly1305/poly1305_vec.c +12 -28
  89. package/third_party/boringssl/src/crypto/siphash/siphash.c +8 -11
  90. package/third_party/boringssl/src/crypto/siphash/siphash_test.cc +5 -7
  91. package/third_party/boringssl/src/crypto/stack/stack.c +33 -16
  92. package/third_party/boringssl/src/crypto/thread_pthread.c +0 -2
  93. package/third_party/boringssl/src/crypto/thread_win.c +0 -2
  94. package/third_party/boringssl/src/crypto/trust_token/internal.h +14 -0
  95. package/third_party/boringssl/src/crypto/trust_token/pmbtoken.c +127 -30
  96. package/third_party/boringssl/src/crypto/trust_token/trust_token.c +40 -0
  97. package/third_party/boringssl/src/crypto/trust_token/trust_token_test.cc +165 -0
  98. package/third_party/boringssl/src/crypto/trust_token/voprf.c +55 -6
  99. package/third_party/boringssl/src/crypto/x509/a_digest.c +23 -24
  100. package/third_party/boringssl/src/crypto/x509/a_sign.c +52 -55
  101. package/third_party/boringssl/src/crypto/x509/a_verify.c +33 -34
  102. package/third_party/boringssl/src/crypto/x509/algorithm.c +17 -18
  103. package/third_party/boringssl/src/crypto/x509/asn1_gen.c +618 -612
  104. package/third_party/boringssl/src/crypto/x509/by_dir.c +320 -337
  105. package/third_party/boringssl/src/crypto/x509/by_file.c +186 -186
  106. package/third_party/boringssl/src/crypto/x509/i2d_pr.c +11 -14
  107. package/third_party/boringssl/src/crypto/x509/internal.h +22 -22
  108. package/third_party/boringssl/src/crypto/x509/name_print.c +155 -150
  109. package/third_party/boringssl/src/crypto/x509/rsa_pss.c +27 -29
  110. package/third_party/boringssl/src/crypto/x509/t_crl.c +67 -70
  111. package/third_party/boringssl/src/crypto/x509/t_req.c +3 -5
  112. package/third_party/boringssl/src/crypto/x509/t_x509.c +280 -251
  113. package/third_party/boringssl/src/crypto/x509/t_x509a.c +52 -47
  114. package/third_party/boringssl/src/crypto/x509/x509.c +3 -4
  115. package/third_party/boringssl/src/crypto/x509/x509_att.c +234 -223
  116. package/third_party/boringssl/src/crypto/x509/x509_cmp.c +286 -296
  117. package/third_party/boringssl/src/crypto/x509/x509_d2.c +37 -32
  118. package/third_party/boringssl/src/crypto/x509/x509_def.c +14 -30
  119. package/third_party/boringssl/src/crypto/x509/x509_ext.c +55 -84
  120. package/third_party/boringssl/src/crypto/x509/x509_lu.c +545 -581
  121. package/third_party/boringssl/src/crypto/x509/x509_obj.c +131 -121
  122. package/third_party/boringssl/src/crypto/x509/x509_req.c +120 -139
  123. package/third_party/boringssl/src/crypto/x509/x509_set.c +128 -142
  124. package/third_party/boringssl/src/crypto/x509/x509_trs.c +185 -193
  125. package/third_party/boringssl/src/crypto/x509/x509_txt.c +70 -72
  126. package/third_party/boringssl/src/crypto/x509/x509_v3.c +172 -161
  127. package/third_party/boringssl/src/crypto/x509/x509_vfy.c +2041 -2053
  128. package/third_party/boringssl/src/crypto/x509/x509_vpm.c +441 -461
  129. package/third_party/boringssl/src/crypto/x509/x509cset.c +152 -170
  130. package/third_party/boringssl/src/crypto/x509/x509name.c +274 -260
  131. package/third_party/boringssl/src/crypto/x509/x509rset.c +43 -20
  132. package/third_party/boringssl/src/crypto/x509/x509spki.c +62 -63
  133. package/third_party/boringssl/src/crypto/x509/x_algor.c +64 -62
  134. package/third_party/boringssl/src/crypto/x509/x_all.c +103 -133
  135. package/third_party/boringssl/src/crypto/x509/x_attrib.c +23 -24
  136. package/third_party/boringssl/src/crypto/x509/x_crl.c +310 -321
  137. package/third_party/boringssl/src/crypto/x509/x_exten.c +6 -5
  138. package/third_party/boringssl/src/crypto/x509/x_info.c +31 -28
  139. package/third_party/boringssl/src/crypto/x509/x_name.c +361 -365
  140. package/third_party/boringssl/src/crypto/x509/x_pkey.c +38 -32
  141. package/third_party/boringssl/src/crypto/x509/x_pubkey.c +114 -117
  142. package/third_party/boringssl/src/crypto/x509/x_req.c +27 -29
  143. package/third_party/boringssl/src/crypto/x509/x_sig.c +2 -2
  144. package/third_party/boringssl/src/crypto/x509/x_spki.c +8 -10
  145. package/third_party/boringssl/src/crypto/x509/x_val.c +2 -2
  146. package/third_party/boringssl/src/crypto/x509/x_x509.c +212 -226
  147. package/third_party/boringssl/src/crypto/x509/x_x509a.c +112 -109
  148. package/third_party/boringssl/src/crypto/x509v3/ext_dat.h +10 -13
  149. package/third_party/boringssl/src/crypto/x509v3/internal.h +72 -87
  150. package/third_party/boringssl/src/crypto/x509v3/pcy_cache.c +184 -176
  151. package/third_party/boringssl/src/crypto/x509v3/pcy_data.c +58 -56
  152. package/third_party/boringssl/src/crypto/x509v3/pcy_lib.c +71 -70
  153. package/third_party/boringssl/src/crypto/x509v3/pcy_map.c +56 -58
  154. package/third_party/boringssl/src/crypto/x509v3/pcy_node.c +89 -91
  155. package/third_party/boringssl/src/crypto/x509v3/pcy_tree.c +585 -590
  156. package/third_party/boringssl/src/crypto/x509v3/v3_akey.c +118 -112
  157. package/third_party/boringssl/src/crypto/x509v3/v3_akeya.c +3 -3
  158. package/third_party/boringssl/src/crypto/x509v3/v3_alt.c +447 -451
  159. package/third_party/boringssl/src/crypto/x509v3/v3_bcons.c +44 -38
  160. package/third_party/boringssl/src/crypto/x509v3/v3_bitst.c +39 -43
  161. package/third_party/boringssl/src/crypto/x509v3/v3_conf.c +321 -320
  162. package/third_party/boringssl/src/crypto/x509v3/v3_cpols.c +352 -327
  163. package/third_party/boringssl/src/crypto/x509v3/v3_crld.c +437 -383
  164. package/third_party/boringssl/src/crypto/x509v3/v3_enum.c +23 -16
  165. package/third_party/boringssl/src/crypto/x509v3/v3_extku.c +62 -53
  166. package/third_party/boringssl/src/crypto/x509v3/v3_genn.c +118 -115
  167. package/third_party/boringssl/src/crypto/x509v3/v3_ia5.c +30 -31
  168. package/third_party/boringssl/src/crypto/x509v3/v3_info.c +112 -98
  169. package/third_party/boringssl/src/crypto/x509v3/v3_int.c +40 -15
  170. package/third_party/boringssl/src/crypto/x509v3/v3_lib.c +248 -252
  171. package/third_party/boringssl/src/crypto/x509v3/v3_ncons.c +390 -386
  172. package/third_party/boringssl/src/crypto/x509v3/v3_ocsp.c +45 -32
  173. package/third_party/boringssl/src/crypto/x509v3/v3_pci.c +206 -209
  174. package/third_party/boringssl/src/crypto/x509v3/v3_pcia.c +6 -8
  175. package/third_party/boringssl/src/crypto/x509v3/v3_pcons.c +54 -50
  176. package/third_party/boringssl/src/crypto/x509v3/v3_pmaps.c +66 -65
  177. package/third_party/boringssl/src/crypto/x509v3/v3_prn.c +144 -133
  178. package/third_party/boringssl/src/crypto/x509v3/v3_purp.c +695 -709
  179. package/third_party/boringssl/src/crypto/x509v3/v3_skey.c +75 -69
  180. package/third_party/boringssl/src/crypto/x509v3/v3_utl.c +1102 -1082
  181. package/third_party/boringssl/src/include/openssl/base.h +3 -1
  182. package/third_party/boringssl/src/include/openssl/bn.h +3 -0
  183. package/third_party/boringssl/src/include/openssl/bytestring.h +20 -0
  184. package/third_party/boringssl/src/include/openssl/evp.h +6 -5
  185. package/third_party/boringssl/src/include/openssl/kdf.h +91 -0
  186. package/third_party/boringssl/src/include/openssl/nid.h +4 -0
  187. package/third_party/boringssl/src/include/openssl/ssl.h +6 -1
  188. package/third_party/boringssl/src/include/openssl/stack.h +47 -32
  189. package/third_party/boringssl/src/include/openssl/trust_token.h +18 -3
  190. package/third_party/boringssl/src/include/openssl/x509.h +18 -0
  191. package/third_party/boringssl/src/ssl/ssl_file.cc +61 -99
  192. package/third_party/boringssl/src/ssl/ssl_test.cc +101 -0
  193. package/third_party/boringssl/src/util/doc.config +2 -1
  194. package/third_party/boringssl/src/util/fipstools/acvp/acvptool/subprocess/subprocess.go +8 -0
  195. package/third_party/googleurl/AUTHORS +16 -2
  196. package/third_party/googleurl/base/BUILD +1 -0
  197. package/third_party/googleurl/base/compiler_specific.h +16 -17
  198. package/third_party/googleurl/base/containers/contiguous_iterator.h +13 -9
  199. package/third_party/googleurl/base/containers/span.h +23 -8
  200. package/third_party/googleurl/base/memory/raw_ptr.h +17 -25
  201. package/third_party/googleurl/base/memory/raw_ptr_exclusion.h +21 -0
  202. package/third_party/googleurl/base/strings/escape.cc +14 -2
  203. package/third_party/googleurl/base/strings/safe_sprintf.h +1 -1
  204. package/third_party/googleurl/base/strings/string_number_conversions.cc +5 -3
  205. package/third_party/googleurl/base/strings/string_number_conversions_internal.h +5 -5
  206. package/third_party/googleurl/base/strings/string_piece.h +3 -3
  207. package/third_party/googleurl/base/strings/string_util.cc +4 -27
  208. package/third_party/googleurl/base/strings/string_util.h +43 -8
  209. package/third_party/googleurl/base/strings/string_util_internal.h +11 -12
  210. package/third_party/googleurl/base/strings/string_util_unittest.cc +33 -0
  211. package/third_party/googleurl/base/strings/string_util_win.cc +0 -5
  212. package/third_party/googleurl/base/strings/string_util_win.h +9 -1
  213. package/third_party/googleurl/base/strings/utf_offset_string_conversions.cc +1 -1
  214. package/third_party/googleurl/base/strings/utf_string_conversion_utils.cc +5 -8
  215. package/third_party/googleurl/base/strings/utf_string_conversion_utils.h +13 -10
  216. package/third_party/googleurl/base/strings/utf_string_conversions.cc +32 -25
  217. package/third_party/googleurl/base/template_util.h +23 -35
  218. package/third_party/googleurl/build/build_config.h +14 -3
  219. package/third_party/googleurl/copy.bara.sky +1 -1
  220. package/third_party/googleurl/url/gurl.cc +8 -4
  221. package/third_party/googleurl/url/gurl.h +1 -0
  222. package/third_party/googleurl/url/gurl_unittest.cc +1 -0
  223. package/third_party/googleurl/url/origin.h +36 -26
  224. package/third_party/googleurl/url/scheme_host_port.h +4 -1
  225. package/third_party/googleurl/url/url_canon.h +2 -1
  226. package/third_party/googleurl/url/url_canon_internal.cc +9 -7
  227. package/third_party/googleurl/url/url_canon_internal.h +16 -16
  228. package/third_party/googleurl/url/url_canon_stdstring.h +2 -1
  229. package/third_party/googleurl/url/url_util.cc +9 -8
  230. package/third_party/quiche/build/source_list.bzl +7 -0
  231. package/third_party/quiche/build/source_list.gni +7 -0
  232. package/third_party/quiche/build/source_list.json +7 -0
  233. package/third_party/quiche/quiche/common/platform/api/quiche_mem_slice.h +7 -3
  234. package/third_party/quiche/quiche/http2/adapter/nghttp2_adapter_test.cc +86 -2
  235. package/third_party/quiche/quiche/http2/adapter/oghttp2_adapter_test.cc +104 -2
  236. package/third_party/quiche/quiche/http2/adapter/oghttp2_session.cc +23 -0
  237. package/third_party/quiche/quiche/http2/adapter/oghttp2_session.h +6 -1
  238. package/third_party/quiche/quiche/quic/core/congestion_control/send_algorithm_test.cc +0 -16
  239. package/third_party/quiche/quiche/quic/core/crypto/crypto_protocol.h +1 -1
  240. package/third_party/quiche/quiche/quic/core/http/end_to_end_test.cc +56 -2
  241. package/third_party/quiche/quiche/quic/core/http/http_constants.cc +1 -0
  242. package/third_party/quiche/quiche/quic/core/http/http_constants.h +1 -0
  243. package/third_party/quiche/quiche/quic/core/http/http_encoder.cc +28 -17
  244. package/third_party/quiche/quiche/quic/core/http/http_encoder.h +5 -0
  245. package/third_party/quiche/quiche/quic/core/http/http_encoder_test.cc +26 -30
  246. package/third_party/quiche/quiche/quic/core/http/http_frames.h +1 -0
  247. package/third_party/quiche/quiche/quic/core/http/quic_server_session_base.cc +4 -4
  248. package/third_party/quiche/quiche/quic/core/http/quic_server_session_base_test.cc +1 -1
  249. package/third_party/quiche/quiche/quic/core/http/quic_spdy_client_session.cc +5 -1
  250. package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.cc +6 -33
  251. package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.h +0 -17
  252. package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream_test.cc +5 -20
  253. package/third_party/quiche/quiche/quic/core/io/quic_event_loop.h +81 -0
  254. package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop.cc +265 -0
  255. package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop.h +152 -0
  256. package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop_test.cc +341 -0
  257. package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store.cc +3 -1
  258. package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store.h +7 -7
  259. package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store_test.cc +4 -3
  260. package/third_party/quiche/quiche/quic/core/quic_connection.cc +69 -19
  261. package/third_party/quiche/quiche/quic/core/quic_connection.h +9 -3
  262. package/third_party/quiche/quiche/quic/core/quic_connection_id_manager.cc +29 -10
  263. package/third_party/quiche/quiche/quic/core/quic_connection_id_manager.h +5 -3
  264. package/third_party/quiche/quiche/quic/core/quic_connection_id_manager_test.cc +85 -22
  265. package/third_party/quiche/quiche/quic/core/quic_connection_test.cc +186 -30
  266. package/third_party/quiche/quiche/quic/core/quic_crypto_stream.cc +2 -1
  267. package/third_party/quiche/quiche/quic/core/quic_default_clock.cc +31 -0
  268. package/third_party/quiche/quiche/quic/core/quic_default_clock.h +34 -0
  269. package/third_party/quiche/quiche/quic/core/quic_default_connection_helper.h +49 -0
  270. package/third_party/quiche/quiche/quic/core/quic_dispatcher.cc +53 -37
  271. package/third_party/quiche/quiche/quic/core/quic_dispatcher.h +19 -11
  272. package/third_party/quiche/quiche/quic/core/quic_dispatcher_test.cc +15 -2
  273. package/third_party/quiche/quiche/quic/core/quic_flags_list.h +10 -4
  274. package/third_party/quiche/quiche/quic/core/quic_idle_network_detector.cc +2 -2
  275. package/third_party/quiche/quiche/quic/core/quic_idle_network_detector_test.cc +4 -4
  276. package/third_party/quiche/quiche/quic/core/quic_packet_creator.cc +14 -3
  277. package/third_party/quiche/quiche/quic/core/quic_packet_creator_test.cc +145 -2
  278. package/third_party/quiche/quiche/quic/core/quic_packets.cc +3 -1
  279. package/third_party/quiche/quiche/quic/core/quic_packets.h +4 -0
  280. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.cc +13 -11
  281. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.h +9 -0
  282. package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager_test.cc +6 -0
  283. package/third_party/quiche/quiche/quic/core/quic_session.cc +3 -2
  284. package/third_party/quiche/quiche/quic/core/quic_session.h +8 -3
  285. package/third_party/quiche/quiche/quic/core/quic_types.cc +18 -0
  286. package/third_party/quiche/quiche/quic/core/quic_types.h +3 -0
  287. package/third_party/quiche/quiche/quic/core/tls_chlo_extractor.cc +3 -0
  288. package/third_party/quiche/quiche/quic/core/tls_chlo_extractor.h +10 -0
  289. package/third_party/quiche/quiche/quic/test_tools/mock_quic_session_visitor.h +1 -1
  290. package/third_party/quiche/quiche/quic/test_tools/quic_test_utils.h +1 -1
  291. package/third_party/quiche/quiche/quic/test_tools/server_thread.cc +3 -2
  292. package/third_party/quiche/quiche/quic/test_tools/simple_session_notifier.cc +7 -1
  293. package/third_party/quiche/quiche/quic/test_tools/simple_session_notifier.h +3 -0
  294. package/third_party/quiche/quiche/quic/test_tools/simulator/quic_endpoint.h +4 -2
  295. package/certs/ca.cnf +0 -69
  296. package/certs/generate_certs.sh +0 -53
  297. package/certs/generate_certs_leaf.sh +0 -53
  298. package/certs/leaf.cnf +0 -24
  299. package/certs/readme.txt +0 -2
  300. package/third_party/quiche/build/BUILD.bazel +0 -7
@@ -47,7 +47,7 @@ class QUIC_EXPORT_PRIVATE QuicConnectionIdManagerVisitorInterface {
47
47
  virtual ~QuicConnectionIdManagerVisitorInterface() = default;
48
48
  virtual void OnPeerIssuedConnectionIdRetired() = 0;
49
49
  virtual bool SendNewConnectionId(const QuicNewConnectionIdFrame& frame) = 0;
50
- virtual void OnNewConnectionIdIssued(
50
+ virtual bool MaybeReserveConnectionId(
51
51
  const QuicConnectionId& connection_id) = 0;
52
52
  virtual void OnSelfIssuedConnectionIdRetired(
53
53
  const QuicConnectionId& connection_id) = 0;
@@ -130,7 +130,8 @@ class QUIC_EXPORT_PRIVATE QuicSelfIssuedConnectionIdManager {
130
130
 
131
131
  virtual ~QuicSelfIssuedConnectionIdManager();
132
132
 
133
- QuicNewConnectionIdFrame IssueNewConnectionIdForPreferredAddress();
133
+ absl::optional<QuicNewConnectionIdFrame>
134
+ MaybeIssueNewConnectionIdForPreferredAddress();
134
135
 
135
136
  QuicErrorCode OnRetireConnectionIdFrame(
136
137
  const QuicRetireConnectionIdFrame& frame, QuicTime::Delta pto_delay,
@@ -164,7 +165,8 @@ class QUIC_EXPORT_PRIVATE QuicSelfIssuedConnectionIdManager {
164
165
  private:
165
166
  friend class test::QuicConnectionIdManagerPeer;
166
167
 
167
- QuicNewConnectionIdFrame IssueNewConnectionId();
168
+ // Issue a new connection ID. Can return nullopt.
169
+ absl::optional<QuicNewConnectionIdFrame> MaybeIssueNewConnectionId();
168
170
 
169
171
  // This should be set to the min of:
170
172
  // (1) # of active connection IDs that peer can maintain.
@@ -64,8 +64,10 @@ class TestPeerIssuedConnectionIdManagerVisitor
64
64
  bool SendNewConnectionId(const QuicNewConnectionIdFrame& /*frame*/) override {
65
65
  return false;
66
66
  }
67
- void OnNewConnectionIdIssued(
68
- const QuicConnectionId& /*connection_id*/) override {}
67
+ bool MaybeReserveConnectionId(const QuicConnectionId&) override {
68
+ return false;
69
+ }
70
+
69
71
  void OnSelfIssuedConnectionIdRetired(
70
72
  const QuicConnectionId& /*connection_id*/) override {}
71
73
 
@@ -522,7 +524,7 @@ class TestSelfIssuedConnectionIdManagerVisitor
522
524
 
523
525
  MOCK_METHOD(bool, SendNewConnectionId,
524
526
  (const QuicNewConnectionIdFrame& frame), (override));
525
- MOCK_METHOD(void, OnNewConnectionIdIssued,
527
+ MOCK_METHOD(bool, MaybeReserveConnectionId,
526
528
  (const QuicConnectionId& connection_id), (override));
527
529
  MOCK_METHOD(void, OnSelfIssuedConnectionIdRetired,
528
530
  (const QuicConnectionId& connection_id), (override));
@@ -568,7 +570,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
568
570
  QuicConnectionId cid5 = cid_manager_.GenerateNewConnectionId(cid4);
569
571
 
570
572
  // Sends CID #1 to peer.
571
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(cid1));
573
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid1))
574
+ .WillOnce(Return(true));
572
575
  EXPECT_CALL(cid_manager_visitor_,
573
576
  SendNewConnectionId(ExpectedNewConnectionIdFrame(cid1, 1u, 0u)))
574
577
  .WillOnce(Return(true));
@@ -578,7 +581,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
578
581
  // Peer retires CID #0;
579
582
  // Sends CID #2 and asks peer to retire CIDs prior to #1.
580
583
  // Outcome: (#1, #2) are active.
581
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(cid2));
584
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid2))
585
+ .WillOnce(Return(true));
582
586
  EXPECT_CALL(cid_manager_visitor_,
583
587
  SendNewConnectionId(ExpectedNewConnectionIdFrame(cid2, 2u, 1u)))
584
588
  .WillOnce(Return(true));
@@ -593,7 +597,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
593
597
  // Peer retires CID #1;
594
598
  // Sends CID #3 and asks peer to retire CIDs prior to #2.
595
599
  // Outcome: (#2, #3) are active.
596
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(cid3));
600
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid3))
601
+ .WillOnce(Return(true));
597
602
  EXPECT_CALL(cid_manager_visitor_,
598
603
  SendNewConnectionId(ExpectedNewConnectionIdFrame(cid3, 3u, 2u)))
599
604
  .WillOnce(Return(true));
@@ -608,7 +613,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
608
613
  // Peer retires CID #2;
609
614
  // Sends CID #4 and asks peer to retire CIDs prior to #3.
610
615
  // Outcome: (#3, #4) are active.
611
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(cid4));
616
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid4))
617
+ .WillOnce(Return(true));
612
618
  EXPECT_CALL(cid_manager_visitor_,
613
619
  SendNewConnectionId(ExpectedNewConnectionIdFrame(cid4, 4u, 3u)))
614
620
  .WillOnce(Return(true));
@@ -623,7 +629,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
623
629
  // Peer retires CID #3;
624
630
  // Sends CID #5 and asks peer to retire CIDs prior to #4.
625
631
  // Outcome: (#4, #5) are active.
626
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(cid5));
632
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid5))
633
+ .WillOnce(Return(true));
627
634
  EXPECT_CALL(cid_manager_visitor_,
628
635
  SendNewConnectionId(ExpectedNewConnectionIdFrame(cid5, 5u, 4u)))
629
636
  .WillOnce(Return(true));
@@ -644,7 +651,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
644
651
  QuicConnectionId cid4 = cid_manager_.GenerateNewConnectionId(cid3);
645
652
 
646
653
  // Sends CID #1 to peer.
647
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(cid1));
654
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid1))
655
+ .WillOnce(Return(true));
648
656
  EXPECT_CALL(cid_manager_visitor_,
649
657
  SendNewConnectionId(ExpectedNewConnectionIdFrame(cid1, 1u, 0u)))
650
658
  .WillOnce(Return(true));
@@ -654,7 +662,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
654
662
  // Peer retires CID #1;
655
663
  // Sends CID #2 and asks peer to retire CIDs prior to #0.
656
664
  // Outcome: (#0, #2) are active.
657
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(cid2));
665
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid2))
666
+ .WillOnce(Return(true));
658
667
  EXPECT_CALL(cid_manager_visitor_,
659
668
  SendNewConnectionId(ExpectedNewConnectionIdFrame(cid2, 2u, 0u)))
660
669
  .WillOnce(Return(true));
@@ -678,7 +687,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
678
687
  // Peer retires CID #0;
679
688
  // Sends CID #3 and asks peer to retire CIDs prior to #2.
680
689
  // Outcome: (#2, #3) are active.
681
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(cid3));
690
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid3))
691
+ .WillOnce(Return(true));
682
692
  EXPECT_CALL(cid_manager_visitor_,
683
693
  SendNewConnectionId(ExpectedNewConnectionIdFrame(cid3, 3u, 2u)))
684
694
  .WillOnce(Return(true));
@@ -693,7 +703,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
693
703
  // Peer retires CID #3;
694
704
  // Sends CID #4 and asks peer to retire CIDs prior to #2.
695
705
  // Outcome: (#2, #4) are active.
696
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(cid4));
706
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid4))
707
+ .WillOnce(Return(true));
697
708
  EXPECT_CALL(cid_manager_visitor_,
698
709
  SendNewConnectionId(ExpectedNewConnectionIdFrame(cid4, 4u, 2u)))
699
710
  .WillOnce(Return(true));
@@ -720,7 +731,9 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
720
731
  QuicConnectionId cid1 = cid_manager_.GenerateNewConnectionId(cid0);
721
732
  QuicConnectionId cid2 = cid_manager_.GenerateNewConnectionId(cid1);
722
733
  QuicConnectionId cid3 = cid_manager_.GenerateNewConnectionId(cid2);
723
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(_)).Times(3);
734
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(_))
735
+ .Times(3)
736
+ .WillRepeatedly(Return(true));
724
737
  EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_))
725
738
  .Times(3)
726
739
  .WillRepeatedly(Return(true));
@@ -777,7 +790,9 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
777
790
  QuicConnectionId cid1 = cid_manager_.GenerateNewConnectionId(cid0);
778
791
  QuicConnectionId cid2 = cid_manager_.GenerateNewConnectionId(cid1);
779
792
  QuicConnectionId cid3 = cid_manager_.GenerateNewConnectionId(cid2);
780
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(_)).Times(3);
793
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(_))
794
+ .Times(3)
795
+ .WillRepeatedly(Return(true));
781
796
  EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_))
782
797
  .Times(3)
783
798
  .WillRepeatedly(Return(true));
@@ -834,7 +849,9 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
834
849
  QuicConnectionId cid2 = cid_manager_.GenerateNewConnectionId(cid1);
835
850
  QuicConnectionId cid3 = cid_manager_.GenerateNewConnectionId(cid2);
836
851
  QuicConnectionId cid;
837
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(_)).Times(3);
852
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(_))
853
+ .Times(3)
854
+ .WillRepeatedly(Return(true));
838
855
  EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_))
839
856
  .Times(3)
840
857
  .WillRepeatedly(Return(true));
@@ -893,7 +910,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
893
910
  QuicConnectionId cid1 = cid_manager_.GenerateNewConnectionId(cid0);
894
911
 
895
912
  // CID #1 is sent to peer.
896
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(_)).Times(1);
913
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(_))
914
+ .WillOnce(Return(true));
897
915
  EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_))
898
916
  .WillOnce(Return(true));
899
917
  cid_manager_.MaybeSendNewConnectionIds();
@@ -909,7 +927,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
909
927
  TEST_F(QuicSelfIssuedConnectionIdManagerTest,
910
928
  ErrorWhenTooManyConnectionIdWaitingToBeRetired) {
911
929
  // CID #0 & #1 are issued.
912
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(_));
930
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(_))
931
+ .WillOnce(Return(true));
913
932
  EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_))
914
933
  .WillOnce(Return(true));
915
934
  cid_manager_.MaybeSendNewConnectionIds();
@@ -918,7 +937,8 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
918
937
  QuicConnectionId last_connection_id =
919
938
  cid_manager_.GenerateNewConnectionId(initial_connection_id_);
920
939
  for (int i = 0; i < 8; ++i) {
921
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(_));
940
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(_))
941
+ .WillOnce(Return(true));
922
942
  EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_));
923
943
  QuicRetireConnectionIdFrame retire_cid_frame;
924
944
  retire_cid_frame.sequence_number = i;
@@ -937,17 +957,60 @@ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
937
957
  IsError(QUIC_TOO_MANY_CONNECTION_ID_WAITING_TO_RETIRE));
938
958
  }
939
959
 
960
+ TEST_F(QuicSelfIssuedConnectionIdManagerTest, CannotIssueNewCidDueToVisitor) {
961
+ QuicConnectionId cid0 = initial_connection_id_;
962
+ QuicConnectionId cid1 = cid_manager_.GenerateNewConnectionId(cid0);
963
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid1))
964
+ .WillOnce(Return(false));
965
+ if (GetQuicReloadableFlag(quic_check_cid_collision_when_issue_new_cid)) {
966
+ EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_)).Times(0);
967
+ } else {
968
+ EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_)).Times(1);
969
+ }
970
+ cid_manager_.MaybeSendNewConnectionIds();
971
+ }
972
+
973
+ TEST_F(QuicSelfIssuedConnectionIdManagerTest,
974
+ CannotIssueNewCidUponRetireConnectionIdDueToVisitor) {
975
+ QuicConnectionId cid0 = initial_connection_id_;
976
+ QuicConnectionId cid1 = cid_manager_.GenerateNewConnectionId(cid0);
977
+ QuicConnectionId cid2 = cid_manager_.GenerateNewConnectionId(cid1);
978
+ // CID #0 & #1 are issued.
979
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid1))
980
+ .WillOnce(Return(true));
981
+ EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_))
982
+ .WillOnce(Return(true));
983
+ cid_manager_.MaybeSendNewConnectionIds();
984
+
985
+ // CID #2 is not issued.
986
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid2))
987
+ .WillOnce(Return(false));
988
+ if (GetQuicReloadableFlag(quic_check_cid_collision_when_issue_new_cid)) {
989
+ EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_)).Times(0);
990
+ } else {
991
+ EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_)).Times(1);
992
+ }
993
+ QuicRetireConnectionIdFrame retire_cid_frame;
994
+ retire_cid_frame.sequence_number = 1;
995
+ ASSERT_THAT(cid_manager_.OnRetireConnectionIdFrame(
996
+ retire_cid_frame, pto_delay_, &error_details_),
997
+ IsQuicNoError());
998
+ }
999
+
940
1000
  TEST_F(QuicSelfIssuedConnectionIdManagerTest,
941
1001
  DoNotIssueConnectionIdVoluntarilyIfOneHasIssuedForPerferredAddress) {
942
1002
  QuicConnectionId cid0 = initial_connection_id_;
943
1003
  QuicConnectionId cid1 = cid_manager_.GenerateNewConnectionId(cid0);
944
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(cid1));
945
- ASSERT_THAT(cid_manager_.IssueNewConnectionIdForPreferredAddress(),
946
- ExpectedNewConnectionIdFrame(cid1, 1u, 0u));
1004
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(cid1))
1005
+ .WillOnce(Return(true));
1006
+ absl::optional<QuicNewConnectionIdFrame> new_cid_frame =
1007
+ cid_manager_.MaybeIssueNewConnectionIdForPreferredAddress();
1008
+ ASSERT_TRUE(new_cid_frame.has_value());
1009
+ ASSERT_THAT(*new_cid_frame, ExpectedNewConnectionIdFrame(cid1, 1u, 0u));
947
1010
  EXPECT_THAT(cid_manager_.GetUnretiredConnectionIds(),
948
1011
  ElementsAre(cid0, cid1));
949
1012
 
950
- EXPECT_CALL(cid_manager_visitor_, OnNewConnectionIdIssued(_)).Times(0);
1013
+ EXPECT_CALL(cid_manager_visitor_, MaybeReserveConnectionId(_)).Times(0);
951
1014
  EXPECT_CALL(cid_manager_visitor_, SendNewConnectionId(_)).Times(0);
952
1015
  cid_manager_.MaybeSendNewConnectionIds();
953
1016
  }
@@ -240,10 +240,19 @@ class TestConnection : public QuicConnection {
240
240
  absl::string_view data,
241
241
  QuicStreamOffset offset,
242
242
  StreamSendingState state) {
243
+ return SaveAndSendStreamData(id, data, offset, state, NOT_RETRANSMISSION);
244
+ }
245
+
246
+ QuicConsumedData SaveAndSendStreamData(QuicStreamId id,
247
+ absl::string_view data,
248
+ QuicStreamOffset offset,
249
+ StreamSendingState state,
250
+ TransmissionType transmission_type) {
243
251
  ScopedPacketFlusher flusher(this);
244
252
  producer_.SaveStreamData(id, data);
245
253
  if (notifier_ != nullptr) {
246
- return notifier_->WriteOrBufferData(id, data.length(), state);
254
+ return notifier_->WriteOrBufferData(id, data.length(), state,
255
+ transmission_type);
247
256
  }
248
257
  return QuicConnection::SendStreamData(id, data.length(), offset, state);
249
258
  }
@@ -1857,9 +1866,11 @@ TEST_P(QuicConnectionTest, PeerIpAddressChangeAtServerWithMissingConnectionId) {
1857
1866
  QuicConnectionPeer::SetAddressValidated(&connection_);
1858
1867
 
1859
1868
  // Sends new server CID to client.
1860
- EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_))
1861
- .WillOnce(
1862
- Invoke([&](const QuicConnectionId& cid) { server_cid1 = cid; }));
1869
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_))
1870
+ .WillOnce(Invoke([&](const QuicConnectionId& cid) {
1871
+ server_cid1 = cid;
1872
+ return true;
1873
+ }));
1863
1874
  EXPECT_CALL(visitor_, SendNewConnectionId(_));
1864
1875
  connection_.OnHandshakeComplete();
1865
1876
 
@@ -2048,8 +2059,11 @@ TEST_P(QuicConnectionTest, ConnectionMigrationWithPendingPaddingBytes) {
2048
2059
 
2049
2060
  // Sends new server CID to client.
2050
2061
  QuicConnectionId new_cid;
2051
- EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_))
2052
- .WillOnce(Invoke([&](const QuicConnectionId& cid) { new_cid = cid; }));
2062
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_))
2063
+ .WillOnce(Invoke([&](const QuicConnectionId& cid) {
2064
+ new_cid = cid;
2065
+ return true;
2066
+ }));
2053
2067
  EXPECT_CALL(visitor_, SendNewConnectionId(_));
2054
2068
  // Discard INITIAL key.
2055
2069
  connection_.RemoveEncrypter(ENCRYPTION_INITIAL);
@@ -2102,8 +2116,11 @@ TEST_P(QuicConnectionTest,
2102
2116
 
2103
2117
  // Sends new server CID to client.
2104
2118
  QuicConnectionId new_cid;
2105
- EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_))
2106
- .WillOnce(Invoke([&](const QuicConnectionId& cid) { new_cid = cid; }));
2119
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_))
2120
+ .WillOnce(Invoke([&](const QuicConnectionId& cid) {
2121
+ new_cid = cid;
2122
+ return true;
2123
+ }));
2107
2124
  EXPECT_CALL(visitor_, SendNewConnectionId(_));
2108
2125
  // Discard INITIAL key.
2109
2126
  connection_.RemoveEncrypter(ENCRYPTION_INITIAL);
@@ -2167,9 +2184,11 @@ TEST_P(QuicConnectionTest, ReversePathValidationFailureAtServer) {
2167
2184
  QuicConnectionId server_cid0 = connection_.connection_id();
2168
2185
  QuicConnectionId server_cid1;
2169
2186
  // Sends new server CID to client.
2170
- EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_))
2171
- .WillOnce(
2172
- Invoke([&](const QuicConnectionId& cid) { server_cid1 = cid; }));
2187
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_))
2188
+ .WillOnce(Invoke([&](const QuicConnectionId& cid) {
2189
+ server_cid1 = cid;
2190
+ return true;
2191
+ }));
2173
2192
  EXPECT_CALL(visitor_, SendNewConnectionId(_));
2174
2193
  connection_.OnHandshakeComplete();
2175
2194
  // Receives new client CID from client.
@@ -3545,6 +3564,86 @@ TEST_P(QuicConnectionTest, RecordSentTimeBeforePacketSent) {
3545
3564
  << ". Actual time = " << actual_recorded_send_time.ToDebuggingValue();
3546
3565
  }
3547
3566
 
3567
+ TEST_P(QuicConnectionTest, ConnectionStatsRetransmission_WithRetransmissions) {
3568
+ // Send two stream frames in 1 packet by queueing them.
3569
+ connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
3570
+
3571
+ {
3572
+ QuicConnection::ScopedPacketFlusher flusher(&connection_);
3573
+ connection_.SaveAndSendStreamData(
3574
+ GetNthClientInitiatedStreamId(1, connection_.transport_version()),
3575
+ "helloworld", 0, NO_FIN, PTO_RETRANSMISSION);
3576
+ connection_.SaveAndSendStreamData(
3577
+ GetNthClientInitiatedStreamId(2, connection_.transport_version()),
3578
+ "helloworld", 0, NO_FIN, LOSS_RETRANSMISSION);
3579
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
3580
+ }
3581
+
3582
+ EXPECT_EQ(0u, connection_.NumQueuedPackets());
3583
+ EXPECT_FALSE(connection_.HasQueuedData());
3584
+
3585
+ EXPECT_EQ(2u, writer_->frame_count());
3586
+ for (auto& frame : writer_->stream_frames()) {
3587
+ EXPECT_EQ(frame->data_length, 10u);
3588
+ }
3589
+
3590
+ ASSERT_EQ(connection_.GetStats().packets_retransmitted, 1u);
3591
+ ASSERT_GE(connection_.GetStats().bytes_retransmitted, 20u);
3592
+ }
3593
+
3594
+ TEST_P(QuicConnectionTest, ConnectionStatsRetransmission_WithMixedFrames) {
3595
+ // Send two stream frames in 1 packet by queueing them.
3596
+ connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
3597
+
3598
+ {
3599
+ QuicConnection::ScopedPacketFlusher flusher(&connection_);
3600
+ // First frame is retransmission. Second is NOT_RETRANSMISSION but the
3601
+ // packet retains the PTO_RETRANSMISSION type.
3602
+ connection_.SaveAndSendStreamData(
3603
+ GetNthClientInitiatedStreamId(1, connection_.transport_version()),
3604
+ "helloworld", 0, NO_FIN, PTO_RETRANSMISSION);
3605
+ connection_.SaveAndSendStreamData(
3606
+ GetNthClientInitiatedStreamId(2, connection_.transport_version()),
3607
+ "helloworld", 0, NO_FIN, NOT_RETRANSMISSION);
3608
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
3609
+ }
3610
+
3611
+ EXPECT_EQ(0u, connection_.NumQueuedPackets());
3612
+ EXPECT_FALSE(connection_.HasQueuedData());
3613
+
3614
+ EXPECT_EQ(2u, writer_->frame_count());
3615
+ for (auto& frame : writer_->stream_frames()) {
3616
+ EXPECT_EQ(frame->data_length, 10u);
3617
+ }
3618
+
3619
+ ASSERT_EQ(connection_.GetStats().packets_retransmitted, 1u);
3620
+ ASSERT_GE(connection_.GetStats().bytes_retransmitted, 10u);
3621
+ }
3622
+
3623
+ TEST_P(QuicConnectionTest, ConnectionStatsRetransmission_NoRetransmission) {
3624
+ // Send two stream frames in 1 packet by queueing them.
3625
+ connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
3626
+
3627
+ {
3628
+ QuicConnection::ScopedPacketFlusher flusher(&connection_);
3629
+ // Both frames are NOT_RETRANSMISSION
3630
+ connection_.SaveAndSendStreamData(
3631
+ GetNthClientInitiatedStreamId(1, connection_.transport_version()),
3632
+ "helloworld", 0, NO_FIN, NOT_RETRANSMISSION);
3633
+ connection_.SaveAndSendStreamData(
3634
+ GetNthClientInitiatedStreamId(2, connection_.transport_version()),
3635
+ "helloworld", 0, NO_FIN, NOT_RETRANSMISSION);
3636
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
3637
+ }
3638
+
3639
+ EXPECT_EQ(0u, connection_.NumQueuedPackets());
3640
+ EXPECT_FALSE(connection_.HasQueuedData());
3641
+
3642
+ EXPECT_EQ(2u, writer_->frame_count());
3643
+ ASSERT_EQ(connection_.GetStats().packets_retransmitted, 0u);
3644
+ ASSERT_EQ(connection_.GetStats().bytes_retransmitted, 0u);
3645
+ }
3646
+
3548
3647
  TEST_P(QuicConnectionTest, FramePacking) {
3549
3648
  // Send two stream frames in 1 packet by queueing them.
3550
3649
  connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
@@ -9782,7 +9881,10 @@ TEST_P(QuicConnectionTest, FailToCoalescePacket) {
9782
9881
  use_tagging_decrypter();
9783
9882
 
9784
9883
  auto test_body = [&] {
9785
- EXPECT_CALL(visitor_, OnHandshakePacketSent());
9884
+ if (!GetQuicReloadableFlag(
9885
+ quic_packet_flusher_check_connected_after_flush_packets)) {
9886
+ EXPECT_CALL(visitor_, OnHandshakePacketSent());
9887
+ }
9786
9888
 
9787
9889
  EXPECT_CALL(visitor_,
9788
9890
  OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF))
@@ -10554,7 +10656,8 @@ TEST_P(QuicConnectionTest, ClientOnlyBlackholeDetectionServer) {
10554
10656
  }
10555
10657
 
10556
10658
  TEST_P(QuicConnectionTest, 2RtoBlackholeDetection) {
10557
- if (!GetQuicReloadableFlag(quic_default_enable_5rto_blackhole_detection2)) {
10659
+ if (!GetQuicReloadableFlag(quic_default_enable_5rto_blackhole_detection2) ||
10660
+ GetQuicReloadableFlag(quic_remove_blackhole_detection_experiments)) {
10558
10661
  return;
10559
10662
  }
10560
10663
  QuicConfig config;
@@ -10581,7 +10684,8 @@ TEST_P(QuicConnectionTest, 2RtoBlackholeDetection) {
10581
10684
  }
10582
10685
 
10583
10686
  TEST_P(QuicConnectionTest, 3RtoBlackholeDetection) {
10584
- if (!GetQuicReloadableFlag(quic_default_enable_5rto_blackhole_detection2)) {
10687
+ if (!GetQuicReloadableFlag(quic_default_enable_5rto_blackhole_detection2) ||
10688
+ GetQuicReloadableFlag(quic_remove_blackhole_detection_experiments)) {
10585
10689
  return;
10586
10690
  }
10587
10691
  QuicConfig config;
@@ -10608,7 +10712,8 @@ TEST_P(QuicConnectionTest, 3RtoBlackholeDetection) {
10608
10712
  }
10609
10713
 
10610
10714
  TEST_P(QuicConnectionTest, 4RtoBlackholeDetection) {
10611
- if (!GetQuicReloadableFlag(quic_default_enable_5rto_blackhole_detection2)) {
10715
+ if (!GetQuicReloadableFlag(quic_default_enable_5rto_blackhole_detection2) ||
10716
+ GetQuicReloadableFlag(quic_remove_blackhole_detection_experiments)) {
10612
10717
  return;
10613
10718
  }
10614
10719
  QuicConfig config;
@@ -10635,7 +10740,8 @@ TEST_P(QuicConnectionTest, 4RtoBlackholeDetection) {
10635
10740
  }
10636
10741
 
10637
10742
  TEST_P(QuicConnectionTest, 6RtoBlackholeDetection) {
10638
- if (!GetQuicReloadableFlag(quic_default_enable_5rto_blackhole_detection2)) {
10743
+ if (!GetQuicReloadableFlag(quic_default_enable_5rto_blackhole_detection2) ||
10744
+ GetQuicReloadableFlag(quic_remove_blackhole_detection_experiments)) {
10639
10745
  return;
10640
10746
  }
10641
10747
  QuicConfig config;
@@ -13219,9 +13325,11 @@ TEST_P(QuicConnectionTest, PathChallengeBeforePeerIpAddressChangeAtServer) {
13219
13325
  QuicConnectionId client_cid1 = TestConnectionId(2);
13220
13326
  QuicConnectionId server_cid1;
13221
13327
  // Sends new server CID to client.
13222
- EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_))
13223
- .WillOnce(
13224
- Invoke([&](const QuicConnectionId& cid) { server_cid1 = cid; }));
13328
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_))
13329
+ .WillOnce(Invoke([&](const QuicConnectionId& cid) {
13330
+ server_cid1 = cid;
13331
+ return true;
13332
+ }));
13225
13333
  EXPECT_CALL(visitor_, SendNewConnectionId(_));
13226
13334
  connection_.MaybeSendConnectionIdToClient();
13227
13335
  // Receives new client CID from client.
@@ -13365,9 +13473,11 @@ TEST_P(QuicConnectionTest,
13365
13473
  QuicConnectionId server_cid0 = connection_.connection_id();
13366
13474
  QuicConnectionId server_cid1;
13367
13475
  // Sends new server CID to client.
13368
- EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_))
13369
- .WillOnce(
13370
- Invoke([&](const QuicConnectionId& cid) { server_cid1 = cid; }));
13476
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_))
13477
+ .WillOnce(Invoke([&](const QuicConnectionId& cid) {
13478
+ server_cid1 = cid;
13479
+ return true;
13480
+ }));
13371
13481
  EXPECT_CALL(visitor_, SendNewConnectionId(_));
13372
13482
  connection_.MaybeSendConnectionIdToClient();
13373
13483
  auto* packet_creator = QuicConnectionPeer::GetPacketCreator(&connection_);
@@ -13484,9 +13594,11 @@ TEST_P(QuicConnectionTest, NoNonProbingFrameOnAlternativePath) {
13484
13594
  QuicConnectionId client_cid1 = TestConnectionId(2);
13485
13595
  QuicConnectionId server_cid1;
13486
13596
  // Sends new server CID to client.
13487
- EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_))
13488
- .WillOnce(
13489
- Invoke([&](const QuicConnectionId& cid) { server_cid1 = cid; }));
13597
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_))
13598
+ .WillOnce(Invoke([&](const QuicConnectionId& cid) {
13599
+ server_cid1 = cid;
13600
+ return true;
13601
+ }));
13490
13602
  EXPECT_CALL(visitor_, SendNewConnectionId(_));
13491
13603
  connection_.MaybeSendConnectionIdToClient();
13492
13604
  // Receives new client CID from client.
@@ -13586,6 +13698,27 @@ TEST_P(QuicConnectionTest, NoNonProbingFrameOnAlternativePath) {
13586
13698
  }
13587
13699
  }
13588
13700
 
13701
+ TEST_P(QuicConnectionTest, DoNotIssueNewCidIfVisitorSaysNo) {
13702
+ set_perspective(Perspective::IS_SERVER);
13703
+ if (!connection_.connection_migration_use_new_cid()) {
13704
+ return;
13705
+ }
13706
+
13707
+ connection_.CreateConnectionIdManager();
13708
+
13709
+ QuicConnectionId server_cid0 = connection_.connection_id();
13710
+ QuicConnectionId client_cid1 = TestConnectionId(2);
13711
+ QuicConnectionId server_cid1;
13712
+ // Sends new server CID to client.
13713
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_)).WillOnce(Return(false));
13714
+ if (GetQuicReloadableFlag(quic_check_cid_collision_when_issue_new_cid)) {
13715
+ EXPECT_CALL(visitor_, SendNewConnectionId(_)).Times(0);
13716
+ } else {
13717
+ EXPECT_CALL(visitor_, SendNewConnectionId(_)).Times(1);
13718
+ }
13719
+ connection_.MaybeSendConnectionIdToClient();
13720
+ }
13721
+
13589
13722
  TEST_P(QuicConnectionTest,
13590
13723
  ProbedOnAnotherPathAfterPeerIpAddressChangeAtServer) {
13591
13724
  PathProbeTestInit(Perspective::IS_SERVER);
@@ -14121,7 +14254,7 @@ TEST_P(QuicConnectionTest, RetireConnectionIdFrameResultsInError) {
14121
14254
  set_perspective(Perspective::IS_SERVER);
14122
14255
  connection_.CreateConnectionIdManager();
14123
14256
 
14124
- EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_));
14257
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_));
14125
14258
  EXPECT_CALL(visitor_, SendNewConnectionId(_));
14126
14259
  connection_.MaybeSendConnectionIdToClient();
14127
14260
 
@@ -14154,7 +14287,9 @@ TEST_P(QuicConnectionTest,
14154
14287
  QuicRetireConnectionIdFrame frame;
14155
14288
  frame.sequence_number = 0u;
14156
14289
  if (connection_.connection_migration_use_new_cid()) {
14157
- EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_)).Times(2);
14290
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_))
14291
+ .Times(2)
14292
+ .WillRepeatedly(Return(true));
14158
14293
  EXPECT_CALL(visitor_, SendNewConnectionId(_)).Times(2);
14159
14294
  }
14160
14295
  EXPECT_TRUE(connection_.OnRetireConnectionIdFrame(frame));
@@ -14174,8 +14309,9 @@ TEST_P(QuicConnectionTest, ServerRetireSelfIssuedConnectionId) {
14174
14309
  set_perspective(Perspective::IS_SERVER);
14175
14310
  connection_.CreateConnectionIdManager();
14176
14311
  QuicConnectionId recorded_cid;
14177
- auto cid_recorder = [&recorded_cid](const QuicConnectionId& cid) {
14312
+ auto cid_recorder = [&recorded_cid](const QuicConnectionId& cid) -> bool {
14178
14313
  recorded_cid = cid;
14314
+ return true;
14179
14315
  };
14180
14316
  QuicConnectionId cid0 = connection_id_;
14181
14317
  QuicConnectionId cid1;
@@ -14184,7 +14320,7 @@ TEST_P(QuicConnectionTest, ServerRetireSelfIssuedConnectionId) {
14184
14320
  EXPECT_EQ(connection_.GetOneActiveServerConnectionId(), cid0);
14185
14321
 
14186
14322
  connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
14187
- EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_))
14323
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_))
14188
14324
  .WillOnce(Invoke(cid_recorder));
14189
14325
  EXPECT_CALL(visitor_, SendNewConnectionId(_));
14190
14326
  connection_.MaybeSendConnectionIdToClient();
@@ -14215,7 +14351,7 @@ TEST_P(QuicConnectionTest, ServerRetireSelfIssuedConnectionId) {
14215
14351
 
14216
14352
  // Packet2 with RetireConnectionId frame trigers sending NewConnectionId
14217
14353
  // immediately.
14218
- EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_))
14354
+ EXPECT_CALL(visitor_, MaybeReserveConnectionId(_))
14219
14355
  .WillOnce(Invoke(cid_recorder));
14220
14356
  EXPECT_CALL(visitor_, SendNewConnectionId(_));
14221
14357
  peer_creator_.SetServerConnectionId(cid1);
@@ -15316,6 +15452,26 @@ TEST_P(QuicConnectionTest, EarliestSentTimeNotInitializedWhenPtoFires) {
15316
15452
  EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet());
15317
15453
  }
15318
15454
 
15455
+ TEST_P(QuicConnectionTest, CalculateNetworkBlackholeDelay) {
15456
+ if (!IsDefaultTestConfiguration()) {
15457
+ return;
15458
+ }
15459
+
15460
+ const QuicTime::Delta kOneSec = QuicTime::Delta::FromSeconds(1);
15461
+ const QuicTime::Delta kTwoSec = QuicTime::Delta::FromSeconds(2);
15462
+ const QuicTime::Delta kFourSec = QuicTime::Delta::FromSeconds(4);
15463
+
15464
+ // Normal case: blackhole_delay longer than path_degrading_delay +
15465
+ // 2*pto_delay.
15466
+ EXPECT_EQ(QuicConnection::CalculateNetworkBlackholeDelay(kFourSec, kOneSec,
15467
+ kOneSec),
15468
+ kFourSec);
15469
+
15470
+ EXPECT_EQ(QuicConnection::CalculateNetworkBlackholeDelay(kFourSec, kOneSec,
15471
+ kTwoSec),
15472
+ QuicTime::Delta::FromSeconds(5));
15473
+ }
15474
+
15319
15475
  } // namespace
15320
15476
  } // namespace test
15321
15477
  } // namespace quic
@@ -166,7 +166,8 @@ void QuicCryptoStream::WriteCryptoData(EncryptionLevel level,
166
166
  << absl::StrCat("Too much data for crypto send buffer with level: ",
167
167
  EncryptionLevelToString(level),
168
168
  ", current_buffer_size: ", current_buffer_size,
169
- ", data length: ", data.length());
169
+ ", data length: ", data.length(),
170
+ ", SNI: ", crypto_negotiated_params().sni);
170
171
  OnUnrecoverableError(QUIC_INTERNAL_ERROR,
171
172
  "Too much data for crypto send buffer");
172
173
  return;
@@ -0,0 +1,31 @@
1
+ // Copyright 2022 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ #include "quiche/quic/core/quic_default_clock.h"
6
+
7
+ #include "absl/time/clock.h"
8
+
9
+ namespace quic {
10
+
11
+ QuicDefaultClock* QuicDefaultClock::Get() {
12
+ static QuicDefaultClock* clock = new QuicDefaultClock();
13
+ return clock;
14
+ }
15
+
16
+ QuicTime QuicDefaultClock::ApproximateNow() const { return Now(); }
17
+
18
+ QuicTime QuicDefaultClock::Now() const {
19
+ return CreateTimeFromMicroseconds(absl::GetCurrentTimeNanos() / 1000);
20
+ }
21
+
22
+ QuicWallTime QuicDefaultClock::WallNow() const {
23
+ return QuicWallTime::FromUNIXMicroseconds(absl::GetCurrentTimeNanos() / 1000);
24
+ }
25
+
26
+ QuicTime QuicDefaultClock::ConvertWallTimeToQuicTime(
27
+ const QuicWallTime& walltime) const {
28
+ return CreateTimeFromMicroseconds(walltime.ToUNIXMicroseconds());
29
+ }
30
+
31
+ } // namespace quic