@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
@@ -5883,12 +5883,12 @@ TEST(NgHttp2AdapterTest, AutomaticPingAcksDisabled) {
5883
5883
  EXPECT_THAT(visitor.data(), EqualsFrames({SpdyFrameType::SETTINGS}));
5884
5884
  }
5885
5885
 
5886
- TEST(NgHttp2AdapterTest, InvalidMaxFrameSize) {
5886
+ TEST(NgHttp2AdapterTest, InvalidMaxFrameSizeSetting) {
5887
5887
  DataSavingVisitor visitor;
5888
5888
  auto adapter = NgHttp2Adapter::CreateServerAdapter(visitor);
5889
5889
 
5890
5890
  const std::string frames =
5891
- TestFrameSequence().ClientPreface({{MAX_FRAME_SIZE, 3}}).Serialize();
5891
+ TestFrameSequence().ClientPreface({{MAX_FRAME_SIZE, 3u}}).Serialize();
5892
5892
  testing::InSequence s;
5893
5893
 
5894
5894
  // Client preface
@@ -5912,6 +5912,90 @@ TEST(NgHttp2AdapterTest, InvalidMaxFrameSize) {
5912
5912
  EXPECT_THAT(visitor.data(), EqualsFrames({SpdyFrameType::GOAWAY}));
5913
5913
  }
5914
5914
 
5915
+ TEST(OgHttp2AdapterTest, InvalidPushSetting) {
5916
+ DataSavingVisitor visitor;
5917
+ auto adapter = NgHttp2Adapter::CreateServerAdapter(visitor);
5918
+
5919
+ const std::string frames =
5920
+ TestFrameSequence().ClientPreface({{ENABLE_PUSH, 3u}}).Serialize();
5921
+ testing::InSequence s;
5922
+
5923
+ // Client preface
5924
+ EXPECT_CALL(visitor, OnFrameHeader(0, 6, SETTINGS, 0));
5925
+ EXPECT_CALL(visitor, OnInvalidFrame(0, _));
5926
+
5927
+ const int64_t read_result = adapter->ProcessBytes(frames);
5928
+ EXPECT_EQ(static_cast<size_t>(read_result), frames.size());
5929
+
5930
+ EXPECT_TRUE(adapter->want_write());
5931
+
5932
+ EXPECT_CALL(visitor, OnBeforeFrameSent(GOAWAY, 0, _, 0x0));
5933
+ EXPECT_CALL(visitor,
5934
+ OnFrameSent(GOAWAY, 0, _, 0x0,
5935
+ static_cast<int>(Http2ErrorCode::PROTOCOL_ERROR)));
5936
+
5937
+ int send_result = adapter->Send();
5938
+ EXPECT_EQ(0, send_result);
5939
+ EXPECT_THAT(visitor.data(), EqualsFrames({SpdyFrameType::GOAWAY}));
5940
+ }
5941
+
5942
+ TEST(NgHttp2AdapterTest, InvalidConnectProtocolSetting) {
5943
+ DataSavingVisitor visitor;
5944
+ auto adapter = NgHttp2Adapter::CreateServerAdapter(visitor);
5945
+
5946
+ const std::string frames = TestFrameSequence()
5947
+ .ClientPreface({{ENABLE_CONNECT_PROTOCOL, 3u}})
5948
+ .Serialize();
5949
+ testing::InSequence s;
5950
+
5951
+ EXPECT_CALL(visitor, OnFrameHeader(0, 6, SETTINGS, 0));
5952
+ EXPECT_CALL(
5953
+ visitor,
5954
+ OnInvalidFrame(0, Http2VisitorInterface::InvalidFrameError::kProtocol));
5955
+
5956
+ int64_t read_result = adapter->ProcessBytes(frames);
5957
+ EXPECT_EQ(static_cast<size_t>(read_result), frames.size());
5958
+
5959
+ EXPECT_TRUE(adapter->want_write());
5960
+
5961
+ EXPECT_CALL(visitor, OnBeforeFrameSent(GOAWAY, 0, _, 0x0));
5962
+ EXPECT_CALL(visitor,
5963
+ OnFrameSent(GOAWAY, 0, _, 0x0,
5964
+ static_cast<int>(Http2ErrorCode::PROTOCOL_ERROR)));
5965
+
5966
+ int send_result = adapter->Send();
5967
+ EXPECT_EQ(0, send_result);
5968
+ EXPECT_THAT(visitor.data(), EqualsFrames({SpdyFrameType::GOAWAY}));
5969
+
5970
+ auto adapter2 = NgHttp2Adapter::CreateServerAdapter(visitor);
5971
+ const std::string frames2 = TestFrameSequence()
5972
+ .ClientPreface({{ENABLE_CONNECT_PROTOCOL, 1}})
5973
+ .Settings({{ENABLE_CONNECT_PROTOCOL, 0}})
5974
+ .Serialize();
5975
+
5976
+ EXPECT_CALL(visitor, OnFrameHeader(0, 6, SETTINGS, 0));
5977
+ EXPECT_CALL(visitor, OnSettingsStart());
5978
+ EXPECT_CALL(visitor, OnSetting(Http2Setting{ENABLE_CONNECT_PROTOCOL, 1u}));
5979
+ EXPECT_CALL(visitor, OnSettingsEnd());
5980
+ EXPECT_CALL(visitor, OnFrameHeader(0, 6, SETTINGS, 0));
5981
+ EXPECT_CALL(visitor, OnSettingsStart());
5982
+ // Surprisingly, nghttp2 allows this behavior, which is prohibited in RFC
5983
+ // 8441.
5984
+ EXPECT_CALL(visitor, OnSetting(Http2Setting{ENABLE_CONNECT_PROTOCOL, 0u}));
5985
+ EXPECT_CALL(visitor, OnSettingsEnd());
5986
+
5987
+ read_result = adapter2->ProcessBytes(frames2);
5988
+ EXPECT_EQ(static_cast<size_t>(read_result), frames2.size());
5989
+
5990
+ EXPECT_TRUE(adapter2->want_write());
5991
+
5992
+ EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x1));
5993
+ EXPECT_CALL(visitor, OnFrameSent(SETTINGS, 0, _, 0x1, 0));
5994
+ EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x1));
5995
+ EXPECT_CALL(visitor, OnFrameSent(SETTINGS, 0, _, 0x1, 0));
5996
+ adapter2->Send();
5997
+ }
5998
+
5915
5999
  TEST(NgHttp2AdapterTest, ServerForbidsProtocolPseudoheaderBeforeAck) {
5916
6000
  DataSavingVisitor visitor;
5917
6001
  auto adapter = NgHttp2Adapter::CreateServerAdapter(visitor);
@@ -347,14 +347,14 @@ TEST(OgHttp2AdapterTest, AutomaticPingAcksDisabled) {
347
347
  EqualsFrames({SpdyFrameType::SETTINGS, SpdyFrameType::SETTINGS}));
348
348
  }
349
349
 
350
- TEST(OgHttp2AdapterTest, InvalidMaxFrameSize) {
350
+ TEST(OgHttp2AdapterTest, InvalidMaxFrameSizeSetting) {
351
351
  DataSavingVisitor visitor;
352
352
  OgHttp2Adapter::Options options;
353
353
  options.perspective = Perspective::kServer;
354
354
  auto adapter = OgHttp2Adapter::Create(visitor, options);
355
355
 
356
356
  const std::string frames =
357
- TestFrameSequence().ClientPreface({{MAX_FRAME_SIZE, 3}}).Serialize();
357
+ TestFrameSequence().ClientPreface({{MAX_FRAME_SIZE, 3u}}).Serialize();
358
358
  testing::InSequence s;
359
359
 
360
360
  // Client preface
@@ -383,6 +383,108 @@ TEST(OgHttp2AdapterTest, InvalidMaxFrameSize) {
383
383
  EqualsFrames({SpdyFrameType::SETTINGS, SpdyFrameType::GOAWAY}));
384
384
  }
385
385
 
386
+ TEST(OgHttp2AdapterTest, InvalidPushSetting) {
387
+ DataSavingVisitor visitor;
388
+ OgHttp2Adapter::Options options;
389
+ options.perspective = Perspective::kServer;
390
+ auto adapter = OgHttp2Adapter::Create(visitor, options);
391
+
392
+ const std::string frames =
393
+ TestFrameSequence().ClientPreface({{ENABLE_PUSH, 3u}}).Serialize();
394
+ testing::InSequence s;
395
+
396
+ // Client preface
397
+ EXPECT_CALL(visitor, OnFrameHeader(0, 6, SETTINGS, 0));
398
+ EXPECT_CALL(visitor, OnSettingsStart());
399
+ EXPECT_CALL(
400
+ visitor,
401
+ OnInvalidFrame(0, Http2VisitorInterface::InvalidFrameError::kProtocol));
402
+ EXPECT_CALL(visitor, OnConnectionError(ConnectionError::kInvalidSetting));
403
+
404
+ const int64_t read_result = adapter->ProcessBytes(frames);
405
+ EXPECT_EQ(static_cast<size_t>(read_result), frames.size());
406
+
407
+ EXPECT_TRUE(adapter->want_write());
408
+
409
+ EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0));
410
+ EXPECT_CALL(visitor, OnFrameSent(SETTINGS, 0, _, 0x0, 0));
411
+ EXPECT_CALL(visitor, OnBeforeFrameSent(GOAWAY, 0, _, 0x0));
412
+ EXPECT_CALL(visitor,
413
+ OnFrameSent(GOAWAY, 0, _, 0x0,
414
+ static_cast<int>(Http2ErrorCode::PROTOCOL_ERROR)));
415
+
416
+ int send_result = adapter->Send();
417
+ EXPECT_EQ(0, send_result);
418
+ EXPECT_THAT(visitor.data(),
419
+ EqualsFrames({SpdyFrameType::SETTINGS, SpdyFrameType::GOAWAY}));
420
+ }
421
+
422
+ TEST(OgHttp2AdapterTest, InvalidConnectProtocolSetting) {
423
+ DataSavingVisitor visitor;
424
+ OgHttp2Adapter::Options options;
425
+ options.perspective = Perspective::kServer;
426
+ auto adapter = OgHttp2Adapter::Create(visitor, options);
427
+
428
+ const std::string frames = TestFrameSequence()
429
+ .ClientPreface({{ENABLE_CONNECT_PROTOCOL, 3u}})
430
+ .Serialize();
431
+ testing::InSequence s;
432
+
433
+ EXPECT_CALL(visitor, OnFrameHeader(0, 6, SETTINGS, 0));
434
+ EXPECT_CALL(visitor, OnSettingsStart());
435
+ EXPECT_CALL(
436
+ visitor,
437
+ OnInvalidFrame(0, Http2VisitorInterface::InvalidFrameError::kProtocol));
438
+ EXPECT_CALL(visitor, OnConnectionError(ConnectionError::kInvalidSetting));
439
+
440
+ int64_t read_result = adapter->ProcessBytes(frames);
441
+ EXPECT_EQ(static_cast<size_t>(read_result), frames.size());
442
+
443
+ EXPECT_TRUE(adapter->want_write());
444
+
445
+ EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0));
446
+ EXPECT_CALL(visitor, OnFrameSent(SETTINGS, 0, _, 0x0, 0));
447
+ EXPECT_CALL(visitor, OnBeforeFrameSent(GOAWAY, 0, _, 0x0));
448
+ EXPECT_CALL(visitor,
449
+ OnFrameSent(GOAWAY, 0, _, 0x0,
450
+ static_cast<int>(Http2ErrorCode::PROTOCOL_ERROR)));
451
+
452
+ int send_result = adapter->Send();
453
+ EXPECT_EQ(0, send_result);
454
+ EXPECT_THAT(visitor.data(),
455
+ EqualsFrames({SpdyFrameType::SETTINGS, SpdyFrameType::GOAWAY}));
456
+
457
+ auto adapter2 = OgHttp2Adapter::Create(visitor, options);
458
+ const std::string frames2 = TestFrameSequence()
459
+ .ClientPreface({{ENABLE_CONNECT_PROTOCOL, 1}})
460
+ .Settings({{ENABLE_CONNECT_PROTOCOL, 0}})
461
+ .Serialize();
462
+
463
+ EXPECT_CALL(visitor, OnFrameHeader(0, 6, SETTINGS, 0));
464
+ EXPECT_CALL(visitor, OnSettingsStart());
465
+ EXPECT_CALL(visitor, OnSetting(Http2Setting{ENABLE_CONNECT_PROTOCOL, 1u}));
466
+ EXPECT_CALL(visitor, OnSettingsEnd());
467
+ EXPECT_CALL(visitor, OnFrameHeader(0, 6, SETTINGS, 0));
468
+ EXPECT_CALL(visitor, OnSettingsStart());
469
+ EXPECT_CALL(
470
+ visitor,
471
+ OnInvalidFrame(0, Http2VisitorInterface::InvalidFrameError::kProtocol));
472
+ EXPECT_CALL(visitor, OnConnectionError(ConnectionError::kInvalidSetting));
473
+
474
+ read_result = adapter2->ProcessBytes(frames2);
475
+ EXPECT_EQ(static_cast<size_t>(read_result), frames2.size());
476
+
477
+ EXPECT_TRUE(adapter2->want_write());
478
+
479
+ EXPECT_CALL(visitor, OnBeforeFrameSent(SETTINGS, 0, _, 0x0));
480
+ EXPECT_CALL(visitor, OnFrameSent(SETTINGS, 0, _, 0x0, 0));
481
+ EXPECT_CALL(visitor, OnBeforeFrameSent(GOAWAY, 0, _, 0x0));
482
+ EXPECT_CALL(visitor,
483
+ OnFrameSent(GOAWAY, 0, _, 0x0,
484
+ static_cast<int>(Http2ErrorCode::PROTOCOL_ERROR)));
485
+ adapter2->Send();
486
+ }
487
+
386
488
  TEST(OgHttp2AdapterTest, ClientHandles100Headers) {
387
489
  DataSavingVisitor visitor;
388
490
  OgHttp2Adapter::Options options;
@@ -1233,6 +1233,18 @@ void OgHttp2Session::OnSetting(spdy::SpdySettingsId id, uint32_t value) {
1233
1233
  encoder_header_table_capacity_when_acking_ = value;
1234
1234
  }
1235
1235
  break;
1236
+ case ENABLE_PUSH:
1237
+ if (value > 1u) {
1238
+ visitor_.OnInvalidFrame(
1239
+ 0, Http2VisitorInterface::InvalidFrameError::kProtocol);
1240
+ // The specification says this is a connection-level protocol error.
1241
+ LatchErrorAndNotify(
1242
+ Http2ErrorCode::PROTOCOL_ERROR,
1243
+ Http2VisitorInterface::ConnectionError::kInvalidSetting);
1244
+ return;
1245
+ }
1246
+ // Aside from validation, this setting is ignored.
1247
+ break;
1236
1248
  case MAX_CONCURRENT_STREAMS:
1237
1249
  max_outbound_concurrent_streams_ = value;
1238
1250
  if (!IsServerSession()) {
@@ -1266,6 +1278,17 @@ void OgHttp2Session::OnSetting(spdy::SpdySettingsId id, uint32_t value) {
1266
1278
  }
1267
1279
  max_frame_payload_ = value;
1268
1280
  break;
1281
+ case ENABLE_CONNECT_PROTOCOL:
1282
+ if (value > 1u || (value == 0 && peer_enables_connect_protocol_)) {
1283
+ visitor_.OnInvalidFrame(
1284
+ 0, Http2VisitorInterface::InvalidFrameError::kProtocol);
1285
+ LatchErrorAndNotify(
1286
+ Http2ErrorCode::PROTOCOL_ERROR,
1287
+ Http2VisitorInterface::ConnectionError::kInvalidSetting);
1288
+ return;
1289
+ }
1290
+ peer_enables_connect_protocol_ = (value == 1u);
1291
+ break;
1269
1292
  default:
1270
1293
  // TODO(bnc): See if C++17 inline constants are allowed in QUICHE.
1271
1294
  if (id == kMetadataExtensionId) {
@@ -153,6 +153,9 @@ class QUICHE_EXPORT_PRIVATE OgHttp2Session
153
153
  !goaway_rejected_streams_.empty());
154
154
  }
155
155
  int GetRemoteWindowSize() const override { return connection_send_window_; }
156
+ bool peer_enables_connect_protocol() {
157
+ return peer_enables_connect_protocol_;
158
+ }
156
159
 
157
160
  // From SpdyFramerVisitorInterface
158
161
  void OnError(http2::Http2DecoderAdapter::SpdyFramerError error,
@@ -508,7 +511,7 @@ class QUICHE_EXPORT_PRIVATE OgHttp2Session
508
511
  int32_t initial_stream_receive_window_ = kInitialFlowControlWindowSize;
509
512
  // The initial flow control send window size for any newly created streams.
510
513
  int32_t initial_stream_send_window_ = kInitialFlowControlWindowSize;
511
- uint32_t max_frame_payload_ = 16384u;
514
+ uint32_t max_frame_payload_ = kDefaultFramePayloadSizeLimit;
512
515
  // The maximum number of concurrent streams that this connection can open to
513
516
  // its peer and allow from its peer, respectively. Although the initial value
514
517
  // is unlimited, the spec encourages a value of at least 100. We limit
@@ -537,6 +540,8 @@ class QUICHE_EXPORT_PRIVATE OgHttp2Session
537
540
  // Recursion guard for Send().
538
541
  bool sending_ = false;
539
542
 
543
+ bool peer_enables_connect_protocol_ = false;
544
+
540
545
  // Replace this with a stream ID, for multiple GOAWAY support.
541
546
  bool queued_goaway_ = false;
542
547
  bool queued_immediate_goaway_ = false;
@@ -102,22 +102,6 @@ const QuicTime::Delta kTestCellularPropagationDelay =
102
102
  const QuicTime::Delta kTestLinkSmallRTTDelay =
103
103
  QuicTime::Delta::FromMilliseconds(10);
104
104
 
105
- const char* CongestionControlTypeToString(CongestionControlType cc_type) {
106
- switch (cc_type) {
107
- case kCubicBytes:
108
- return "CUBIC_BYTES";
109
- case kRenoBytes:
110
- return "RENO_BYTES";
111
- case kBBR:
112
- return "BBR";
113
- case kPCC:
114
- return "PCC";
115
- default:
116
- QUIC_DLOG(FATAL) << "Unexpected CongestionControlType";
117
- return nullptr;
118
- }
119
- }
120
-
121
105
  struct TestParams {
122
106
  explicit TestParams(CongestionControlType congestion_control_type)
123
107
  : congestion_control_type(congestion_control_type) {}
@@ -301,7 +301,7 @@ const QuicTag kNPCO = TAG('N', 'P', 'C', 'O'); // No pacing offload.
301
301
  const QuicTag kBWRE = TAG('B', 'W', 'R', 'E'); // Bandwidth resumption.
302
302
  const QuicTag kBWMX = TAG('B', 'W', 'M', 'X'); // Max bandwidth resumption.
303
303
  const QuicTag kBWID = TAG('B', 'W', 'I', 'D'); // Send bandwidth when idle.
304
- const QuicTag kBWR1 = TAG('B', 'W', 'I', '1'); // Resume bandwidth experiment 1
304
+ const QuicTag kBWI1 = TAG('B', 'W', 'I', '1'); // Resume bandwidth experiment 1
305
305
  const QuicTag kBWRS = TAG('B', 'W', 'R', 'S'); // Server bandwidth resumption.
306
306
  const QuicTag kBWS2 = TAG('B', 'W', 'S', '2'); // Server bw resumption v2.
307
307
  const QuicTag kBWS3 = TAG('B', 'W', 'S', '3'); // QUIC Initial CWND - Control.
@@ -201,6 +201,7 @@ class EndToEndTest : public QuicTestWithParam<TestParams> {
201
201
  connect_to_server_on_initialize_(true),
202
202
  server_address_(QuicSocketAddress(TestLoopback(), 0)),
203
203
  server_hostname_("test.example.com"),
204
+ fd_(kQuicInvalidSocketFd),
204
205
  client_writer_(nullptr),
205
206
  server_writer_(nullptr),
206
207
  version_(GetParam().version),
@@ -464,10 +465,24 @@ class EndToEndTest : public QuicTestWithParam<TestParams> {
464
465
  } else {
465
466
  ADD_FAILURE() << "Missing client connection";
466
467
  }
467
- StopServer();
468
+ StopServer(/*will_restart=*/false);
469
+ if (fd_ != kQuicInvalidSocketFd) {
470
+ // Every test should follow StopServer(true) with StartServer(), so we
471
+ // should never get here.
472
+ QuicUdpSocketApi socket_api;
473
+ socket_api.Destroy(fd_);
474
+ fd_ = kQuicInvalidSocketFd;
475
+ }
468
476
  }
469
477
 
470
478
  void StartServer() {
479
+ if (fd_ != kQuicInvalidSocketFd) {
480
+ // We previously called StopServer to reserve the ephemeral port. Close
481
+ // the socket so that it's available below.
482
+ QuicUdpSocketApi socket_api;
483
+ socket_api.Destroy(fd_);
484
+ fd_ = kQuicInvalidSocketFd;
485
+ }
471
486
  auto test_server = std::make_unique<QuicTestServer>(
472
487
  crypto_test_utils::ProofSourceForTesting(), server_config_,
473
488
  server_supported_versions_, &memory_cache_backend_,
@@ -485,6 +500,7 @@ class EndToEndTest : public QuicTestWithParam<TestParams> {
485
500
  QuicSocketAddress(server_address_.host(), server_thread_->GetPort());
486
501
  QuicDispatcher* dispatcher =
487
502
  QuicServerPeer::GetDispatcher(server_thread_->server());
503
+ ASSERT_TRUE(dispatcher != nullptr);
488
504
  QuicDispatcherPeer::UseWriter(dispatcher, server_writer_);
489
505
 
490
506
  server_writer_->Initialize(QuicDispatcherPeer::GetHelper(dispatcher),
@@ -498,11 +514,30 @@ class EndToEndTest : public QuicTestWithParam<TestParams> {
498
514
  server_thread_->Start();
499
515
  }
500
516
 
501
- void StopServer() {
517
+ void StopServer(bool will_restart = true) {
502
518
  if (server_thread_) {
503
519
  server_thread_->Quit();
504
520
  server_thread_->Join();
505
521
  }
522
+ if (will_restart) {
523
+ // server_address_ now contains the random listening port. Since many
524
+ // tests will attempt to re-bind the socket, claim it so that the kernel
525
+ // doesn't give away the ephemeral port.
526
+ QuicUdpSocketApi socket_api;
527
+ fd_ = socket_api.Create(
528
+ server_address_.host().AddressFamilyToInt(),
529
+ /*receive_buffer_size =*/kDefaultSocketReceiveBuffer,
530
+ /*send_buffer_size =*/kDefaultSocketReceiveBuffer);
531
+ if (fd_ == kQuicInvalidSocketFd) {
532
+ QUIC_LOG(ERROR) << "CreateSocket() failed: " << strerror(errno);
533
+ return;
534
+ }
535
+ int rc = socket_api.Bind(fd_, server_address_);
536
+ if (rc < 0) {
537
+ QUIC_LOG(ERROR) << "Bind failed: " << strerror(errno);
538
+ return;
539
+ }
540
+ }
506
541
  }
507
542
 
508
543
  void AddToCache(absl::string_view path, int response_code,
@@ -834,6 +869,9 @@ class EndToEndTest : public QuicTestWithParam<TestParams> {
834
869
  std::string server_hostname_;
835
870
  QuicTestBackend memory_cache_backend_;
836
871
  std::unique_ptr<ServerThread> server_thread_;
872
+ // This socket keeps the ephemeral port reserved so that the kernel doesn't
873
+ // give it away while the server is shut down.
874
+ QuicUdpSocketFd fd_;
837
875
  std::unique_ptr<QuicTestClient> client_;
838
876
  QuicConnectionDebugVisitor* connection_debug_visitor_ = nullptr;
839
877
  PacketDroppingTestWriter* client_writer_;
@@ -5950,6 +5988,10 @@ TEST_P(EndToEndTest, CustomTransportParameters) {
5950
5988
  }
5951
5989
 
5952
5990
  TEST_P(EndToEndTest, LegacyVersionEncapsulation) {
5991
+ if (GetQuicRestartFlag(quic_disable_legacy_version_encapsulation)) {
5992
+ ASSERT_TRUE(Initialize());
5993
+ return;
5994
+ }
5953
5995
  if (!version_.HasLongHeaderLengths() ||
5954
5996
  override_server_connection_id_length_ > -1) {
5955
5997
  // Decapsulating Legacy Version Encapsulation packets from these versions
@@ -5968,6 +6010,10 @@ TEST_P(EndToEndTest, LegacyVersionEncapsulation) {
5968
6010
  }
5969
6011
 
5970
6012
  TEST_P(EndToEndTest, LegacyVersionEncapsulationWithMultiPacketChlo) {
6013
+ if (GetQuicRestartFlag(quic_disable_legacy_version_encapsulation)) {
6014
+ ASSERT_TRUE(Initialize());
6015
+ return;
6016
+ }
5971
6017
  if (!version_.HasLongHeaderLengths() ||
5972
6018
  override_server_connection_id_length_ > -1) {
5973
6019
  // Decapsulating Legacy Version Encapsulation packets from these versions
@@ -5996,6 +6042,10 @@ TEST_P(EndToEndTest, LegacyVersionEncapsulationWithMultiPacketChlo) {
5996
6042
  }
5997
6043
 
5998
6044
  TEST_P(EndToEndTest, LegacyVersionEncapsulationWithVersionNegotiation) {
6045
+ if (GetQuicRestartFlag(quic_disable_legacy_version_encapsulation)) {
6046
+ ASSERT_TRUE(Initialize());
6047
+ return;
6048
+ }
5999
6049
  if (!version_.HasLongHeaderLengths() ||
6000
6050
  override_server_connection_id_length_ > -1) {
6001
6051
  // Decapsulating Legacy Version Encapsulation packets from these versions
@@ -6016,6 +6066,10 @@ TEST_P(EndToEndTest, LegacyVersionEncapsulationWithVersionNegotiation) {
6016
6066
  }
6017
6067
 
6018
6068
  TEST_P(EndToEndTest, LegacyVersionEncapsulationWithLoss) {
6069
+ if (GetQuicRestartFlag(quic_disable_legacy_version_encapsulation)) {
6070
+ ASSERT_TRUE(Initialize());
6071
+ return;
6072
+ }
6019
6073
  if (!version_.HasLongHeaderLengths() ||
6020
6074
  override_server_connection_id_length_ > -1) {
6021
6075
  // Decapsulating Legacy Version Encapsulation packets from these versions
@@ -21,6 +21,7 @@ std::string H3SettingsToString(Http3AndQpackSettingsIdentifiers identifier) {
21
21
  RETURN_STRING_LITERAL(SETTINGS_H3_DATAGRAM_DRAFT09);
22
22
  RETURN_STRING_LITERAL(SETTINGS_WEBTRANS_DRAFT00);
23
23
  RETURN_STRING_LITERAL(SETTINGS_ENABLE_CONNECT_PROTOCOL);
24
+ RETURN_STRING_LITERAL(SETTINGS_ENABLE_METADATA);
24
25
  }
25
26
  return absl::StrCat("UNSUPPORTED_SETTINGS_TYPE(", identifier, ")");
26
27
  }
@@ -46,6 +46,7 @@ enum Http3AndQpackSettingsIdentifiers : uint64_t {
46
46
  SETTINGS_WEBTRANS_DRAFT00 = 0x2b603742,
47
47
  // draft-ietf-httpbis-h3-websockets
48
48
  SETTINGS_ENABLE_CONNECT_PROTOCOL = 0x08,
49
+ SETTINGS_ENABLE_METADATA = 0x4d44,
49
50
  };
50
51
 
51
52
  // Returns HTTP/3 SETTINGS identifier as a string.
@@ -33,7 +33,6 @@ QuicByteCount GetTotalLength(QuicByteCount payload_length, HttpFrameType type) {
33
33
 
34
34
  } // namespace
35
35
 
36
- // static
37
36
  QuicByteCount HttpEncoder::GetDataFrameHeaderLength(
38
37
  QuicByteCount payload_length) {
39
38
  QUICHE_DCHECK_NE(0u, payload_length);
@@ -42,7 +41,6 @@ QuicByteCount HttpEncoder::GetDataFrameHeaderLength(
42
41
  static_cast<uint64_t>(HttpFrameType::DATA));
43
42
  }
44
43
 
45
- // static
46
44
  quiche::QuicheBuffer HttpEncoder::SerializeDataFrameHeader(
47
45
  QuicByteCount payload_length, quiche::QuicheBufferAllocator* allocator) {
48
46
  QUICHE_DCHECK_NE(0u, payload_length);
@@ -59,7 +57,6 @@ quiche::QuicheBuffer HttpEncoder::SerializeDataFrameHeader(
59
57
  return quiche::QuicheBuffer();
60
58
  }
61
59
 
62
- // static
63
60
  QuicByteCount HttpEncoder::SerializeHeadersFrameHeader(
64
61
  QuicByteCount payload_length, std::unique_ptr<char[]>* output) {
65
62
  QUICHE_DCHECK_NE(0u, payload_length);
@@ -68,7 +65,7 @@ QuicByteCount HttpEncoder::SerializeHeadersFrameHeader(
68
65
  QuicDataWriter::GetVarInt62Len(
69
66
  static_cast<uint64_t>(HttpFrameType::HEADERS));
70
67
 
71
- output->reset(new char[header_length]);
68
+ *output = std::make_unique<char[]>(header_length);
72
69
  QuicDataWriter writer(header_length, output->get());
73
70
 
74
71
  if (WriteFrameHeader(payload_length, HttpFrameType::HEADERS, &writer)) {
@@ -80,7 +77,6 @@ QuicByteCount HttpEncoder::SerializeHeadersFrameHeader(
80
77
  return 0;
81
78
  }
82
79
 
83
- // static
84
80
  QuicByteCount HttpEncoder::SerializeSettingsFrame(
85
81
  const SettingsFrame& settings, std::unique_ptr<char[]>* output) {
86
82
  QuicByteCount payload_length = 0;
@@ -96,7 +92,7 @@ QuicByteCount HttpEncoder::SerializeSettingsFrame(
96
92
  QuicByteCount total_length =
97
93
  GetTotalLength(payload_length, HttpFrameType::SETTINGS);
98
94
 
99
- output->reset(new char[total_length]);
95
+ *output = std::make_unique<char[]>(total_length);
100
96
  QuicDataWriter writer(total_length, output->get());
101
97
 
102
98
  if (!WriteFrameHeader(payload_length, HttpFrameType::SETTINGS, &writer)) {
@@ -116,14 +112,13 @@ QuicByteCount HttpEncoder::SerializeSettingsFrame(
116
112
  return total_length;
117
113
  }
118
114
 
119
- // static
120
115
  QuicByteCount HttpEncoder::SerializeGoAwayFrame(
121
116
  const GoAwayFrame& goaway, std::unique_ptr<char[]>* output) {
122
117
  QuicByteCount payload_length = QuicDataWriter::GetVarInt62Len(goaway.id);
123
118
  QuicByteCount total_length =
124
119
  GetTotalLength(payload_length, HttpFrameType::GOAWAY);
125
120
 
126
- output->reset(new char[total_length]);
121
+ *output = std::make_unique<char[]>(total_length);
127
122
  QuicDataWriter writer(total_length, output->get());
128
123
 
129
124
  if (WriteFrameHeader(payload_length, HttpFrameType::GOAWAY, &writer) &&
@@ -135,7 +130,6 @@ QuicByteCount HttpEncoder::SerializeGoAwayFrame(
135
130
  return 0;
136
131
  }
137
132
 
138
- // static
139
133
  QuicByteCount HttpEncoder::SerializePriorityUpdateFrame(
140
134
  const PriorityUpdateFrame& priority_update,
141
135
  std::unique_ptr<char[]>* output) {
@@ -151,7 +145,7 @@ QuicByteCount HttpEncoder::SerializePriorityUpdateFrame(
151
145
  QuicByteCount total_length = GetTotalLength(
152
146
  payload_length, HttpFrameType::PRIORITY_UPDATE_REQUEST_STREAM);
153
147
 
154
- output->reset(new char[total_length]);
148
+ *output = std::make_unique<char[]>(total_length);
155
149
  QuicDataWriter writer(total_length, output->get());
156
150
 
157
151
  if (WriteFrameHeader(payload_length,
@@ -168,7 +162,6 @@ QuicByteCount HttpEncoder::SerializePriorityUpdateFrame(
168
162
  return 0;
169
163
  }
170
164
 
171
- // static
172
165
  QuicByteCount HttpEncoder::SerializeAcceptChFrame(
173
166
  const AcceptChFrame& accept_ch, std::unique_ptr<char[]>* output) {
174
167
  QuicByteCount payload_length = 0;
@@ -182,7 +175,7 @@ QuicByteCount HttpEncoder::SerializeAcceptChFrame(
182
175
  QuicByteCount total_length =
183
176
  GetTotalLength(payload_length, HttpFrameType::ACCEPT_CH);
184
177
 
185
- output->reset(new char[total_length]);
178
+ *output = std::make_unique<char[]>(total_length);
186
179
  QuicDataWriter writer(total_length, output->get());
187
180
 
188
181
  if (!WriteFrameHeader(payload_length, HttpFrameType::ACCEPT_CH, &writer)) {
@@ -203,7 +196,6 @@ QuicByteCount HttpEncoder::SerializeAcceptChFrame(
203
196
  return total_length;
204
197
  }
205
198
 
206
- // static
207
199
  QuicByteCount HttpEncoder::SerializeGreasingFrame(
208
200
  std::unique_ptr<char[]>* output) {
209
201
  uint64_t frame_type;
@@ -222,16 +214,15 @@ QuicByteCount HttpEncoder::SerializeGreasingFrame(
222
214
  payload_length = result % 4;
223
215
 
224
216
  if (payload_length > 0) {
225
- std::unique_ptr<char[]> buffer(new char[payload_length]);
226
- QuicRandom::GetInstance()->RandBytes(buffer.get(), payload_length);
227
- payload = std::string(buffer.get(), payload_length);
217
+ payload.resize(payload_length);
218
+ QuicRandom::GetInstance()->RandBytes(payload.data(), payload_length);
228
219
  }
229
220
  }
230
221
  QuicByteCount total_length = QuicDataWriter::GetVarInt62Len(frame_type) +
231
222
  QuicDataWriter::GetVarInt62Len(payload_length) +
232
223
  payload_length;
233
224
 
234
- output->reset(new char[total_length]);
225
+ *output = std::make_unique<char[]>(total_length);
235
226
  QuicDataWriter writer(total_length, output->get());
236
227
 
237
228
  bool success =
@@ -270,4 +261,24 @@ QuicByteCount HttpEncoder::SerializeWebTransportStreamFrameHeader(
270
261
  return 0;
271
262
  }
272
263
 
264
+ QuicByteCount HttpEncoder::SerializeMetadataFrameHeader(
265
+ QuicByteCount payload_length, std::unique_ptr<char[]>* output) {
266
+ QUICHE_DCHECK_NE(0u, payload_length);
267
+ QuicByteCount header_length =
268
+ QuicDataWriter::GetVarInt62Len(payload_length) +
269
+ QuicDataWriter::GetVarInt62Len(
270
+ static_cast<uint64_t>(HttpFrameType::METADATA));
271
+
272
+ *output = std::make_unique<char[]>(header_length);
273
+ QuicDataWriter writer(header_length, output->get());
274
+
275
+ if (WriteFrameHeader(payload_length, HttpFrameType::METADATA, &writer)) {
276
+ return header_length;
277
+ }
278
+ QUIC_DLOG(ERROR)
279
+ << "Http encoder failed when attempting to serialize METADATA "
280
+ "frame header.";
281
+ return 0;
282
+ }
283
+
273
284
  } // namespace quic
@@ -65,6 +65,11 @@ class QUIC_EXPORT_PRIVATE HttpEncoder {
65
65
  // https://www.ietf.org/archive/id/draft-ietf-webtrans-http3-00.html#name-client-initiated-bidirectio
66
66
  static QuicByteCount SerializeWebTransportStreamFrameHeader(
67
67
  WebTransportSessionId session_id, std::unique_ptr<char[]>* output);
68
+
69
+ // Serializes a METADATA frame header into a new buffer stored in |output|.
70
+ // Returns the length of the buffer on success, or 0 otherwise.
71
+ static QuicByteCount SerializeMetadataFrameHeader(
72
+ QuicByteCount payload_length, std::unique_ptr<char[]>* output);
68
73
  };
69
74
 
70
75
  } // namespace quic