@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.
- package/package.json +1 -1
- package/readme.md +1 -3
- package/src/http3eventloop.cc +83 -9
- package/src/http3eventloop.h +13 -3
- package/src/http3server.cc +22 -22
- package/src/http3server.h +7 -20
- package/src/http3wtstreamvisitor.cc +31 -10
- package/src/http3wtstreamvisitor.h +38 -11
- package/src/webtransport.js +91 -23
- package/test/echoserver.js +29 -5
- package/test/testsuite.js +242 -220
- package/third_party/boringssl/src/CMakeLists.txt +2 -0
- package/third_party/boringssl/src/crypto/CMakeLists.txt +1 -0
- package/third_party/boringssl/src/crypto/asn1/a_bitstr.c +174 -177
- package/third_party/boringssl/src/crypto/asn1/a_bool.c +46 -48
- package/third_party/boringssl/src/crypto/asn1/a_d2i_fp.c +21 -23
- package/third_party/boringssl/src/crypto/asn1/a_dup.c +21 -23
- package/third_party/boringssl/src/crypto/asn1/a_gentm.c +84 -187
- package/third_party/boringssl/src/crypto/asn1/a_i2d_fp.c +19 -21
- package/third_party/boringssl/src/crypto/asn1/a_int.c +305 -329
- package/third_party/boringssl/src/crypto/asn1/a_mbstr.c +190 -195
- package/third_party/boringssl/src/crypto/asn1/a_object.c +182 -189
- package/third_party/boringssl/src/crypto/asn1/a_octet.c +6 -9
- package/third_party/boringssl/src/crypto/asn1/a_print.c +15 -16
- package/third_party/boringssl/src/crypto/asn1/a_strex.c +386 -399
- package/third_party/boringssl/src/crypto/asn1/a_strnid.c +110 -131
- package/third_party/boringssl/src/crypto/asn1/a_time.c +118 -111
- package/third_party/boringssl/src/crypto/asn1/a_type.c +59 -60
- package/third_party/boringssl/src/crypto/asn1/a_utctm.c +114 -186
- package/third_party/boringssl/src/crypto/asn1/a_utf8.c +171 -159
- package/third_party/boringssl/src/crypto/asn1/asn1_lib.c +245 -260
- package/third_party/boringssl/src/crypto/asn1/asn1_par.c +41 -40
- package/third_party/boringssl/src/crypto/asn1/asn1_test.cc +31 -0
- package/third_party/boringssl/src/crypto/asn1/asn_pack.c +31 -33
- package/third_party/boringssl/src/crypto/asn1/f_int.c +36 -33
- package/third_party/boringssl/src/crypto/asn1/f_string.c +29 -26
- package/third_party/boringssl/src/crypto/asn1/internal.h +62 -61
- package/third_party/boringssl/src/crypto/asn1/tasn_dec.c +706 -702
- package/third_party/boringssl/src/crypto/asn1/tasn_enc.c +507 -524
- package/third_party/boringssl/src/crypto/asn1/tasn_fre.c +141 -133
- package/third_party/boringssl/src/crypto/asn1/tasn_new.c +207 -199
- package/third_party/boringssl/src/crypto/asn1/tasn_typ.c +19 -22
- package/third_party/boringssl/src/crypto/asn1/tasn_utl.c +24 -24
- package/third_party/boringssl/src/crypto/asn1/time_support.c +13 -13
- package/third_party/boringssl/src/crypto/bio/connect.c +9 -3
- package/third_party/boringssl/src/crypto/bytestring/bytestring_test.cc +125 -1
- package/third_party/boringssl/src/crypto/bytestring/cbb.c +4 -7
- package/third_party/boringssl/src/crypto/bytestring/cbs.c +167 -9
- package/third_party/boringssl/src/crypto/cipher_extra/e_aesctrhmac.c +0 -2
- package/third_party/boringssl/src/crypto/cipher_extra/e_aesgcmsiv.c +23 -54
- package/third_party/boringssl/src/crypto/cipher_extra/e_chacha20poly1305.c +0 -2
- package/third_party/boringssl/src/crypto/cipher_extra/e_tls.c +0 -2
- package/third_party/boringssl/src/crypto/curve25519/curve25519.c +6 -8
- package/third_party/boringssl/src/crypto/evp/evp_ctx.c +25 -22
- package/third_party/boringssl/src/crypto/evp/internal.h +15 -9
- package/third_party/boringssl/src/crypto/evp/p_dsa_asn1.c +2 -0
- package/third_party/boringssl/src/crypto/evp/p_ec_asn1.c +2 -0
- package/third_party/boringssl/src/crypto/evp/p_ed25519.c +3 -3
- package/third_party/boringssl/src/crypto/evp/p_ed25519_asn1.c +10 -7
- package/third_party/boringssl/src/crypto/evp/p_hkdf.c +241 -0
- package/third_party/boringssl/src/crypto/evp/p_rsa_asn1.c +2 -0
- package/third_party/boringssl/src/crypto/evp/p_x25519_asn1.c +1 -0
- package/third_party/boringssl/src/crypto/fipsmodule/aes/aes_nohw.c +9 -10
- package/third_party/boringssl/src/crypto/fipsmodule/aes/key_wrap.c +2 -6
- package/third_party/boringssl/src/crypto/fipsmodule/bn/exponentiation.c +5 -11
- package/third_party/boringssl/src/crypto/fipsmodule/bn/internal.h +1 -1
- package/third_party/boringssl/src/crypto/fipsmodule/bn/prime.c +2 -0
- package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aes.c +10 -26
- package/third_party/boringssl/src/crypto/fipsmodule/cipher/e_aesccm.c +2 -3
- package/third_party/boringssl/src/crypto/fipsmodule/digestsign/digestsign.c +1 -0
- package/third_party/boringssl/src/crypto/fipsmodule/ec/p256-nistz.c +44 -43
- package/third_party/boringssl/src/crypto/fipsmodule/modes/cbc.c +5 -9
- package/third_party/boringssl/src/crypto/fipsmodule/modes/gcm.c +14 -21
- package/third_party/boringssl/src/crypto/fipsmodule/rand/ctrdrbg.c +8 -8
- package/third_party/boringssl/src/crypto/fipsmodule/rand/internal.h +1 -4
- package/third_party/boringssl/src/crypto/hkdf/hkdf_test.cc +104 -0
- package/third_party/boringssl/src/crypto/internal.h +18 -4
- package/third_party/boringssl/src/crypto/lhash/internal.h +13 -1
- package/third_party/boringssl/src/crypto/obj/obj_dat.h +4 -1
- package/third_party/boringssl/src/crypto/obj/obj_mac.num +1 -0
- package/third_party/boringssl/src/crypto/obj/objects.txt +2 -0
- package/third_party/boringssl/src/crypto/pem/pem_all.c +77 -86
- package/third_party/boringssl/src/crypto/pem/pem_info.c +221 -233
- package/third_party/boringssl/src/crypto/pem/pem_lib.c +639 -608
- package/third_party/boringssl/src/crypto/pem/pem_oth.c +17 -16
- package/third_party/boringssl/src/crypto/pem/pem_pk8.c +133 -142
- package/third_party/boringssl/src/crypto/pem/pem_pkey.c +96 -92
- package/third_party/boringssl/src/crypto/poly1305/poly1305_vec.c +12 -28
- package/third_party/boringssl/src/crypto/siphash/siphash.c +8 -11
- package/third_party/boringssl/src/crypto/siphash/siphash_test.cc +5 -7
- package/third_party/boringssl/src/crypto/stack/stack.c +33 -16
- package/third_party/boringssl/src/crypto/thread_pthread.c +0 -2
- package/third_party/boringssl/src/crypto/thread_win.c +0 -2
- package/third_party/boringssl/src/crypto/trust_token/internal.h +14 -0
- package/third_party/boringssl/src/crypto/trust_token/pmbtoken.c +127 -30
- package/third_party/boringssl/src/crypto/trust_token/trust_token.c +40 -0
- package/third_party/boringssl/src/crypto/trust_token/trust_token_test.cc +165 -0
- package/third_party/boringssl/src/crypto/trust_token/voprf.c +55 -6
- package/third_party/boringssl/src/crypto/x509/a_digest.c +23 -24
- package/third_party/boringssl/src/crypto/x509/a_sign.c +52 -55
- package/third_party/boringssl/src/crypto/x509/a_verify.c +33 -34
- package/third_party/boringssl/src/crypto/x509/algorithm.c +17 -18
- package/third_party/boringssl/src/crypto/x509/asn1_gen.c +618 -612
- package/third_party/boringssl/src/crypto/x509/by_dir.c +320 -337
- package/third_party/boringssl/src/crypto/x509/by_file.c +186 -186
- package/third_party/boringssl/src/crypto/x509/i2d_pr.c +11 -14
- package/third_party/boringssl/src/crypto/x509/internal.h +22 -22
- package/third_party/boringssl/src/crypto/x509/name_print.c +155 -150
- package/third_party/boringssl/src/crypto/x509/rsa_pss.c +27 -29
- package/third_party/boringssl/src/crypto/x509/t_crl.c +67 -70
- package/third_party/boringssl/src/crypto/x509/t_req.c +3 -5
- package/third_party/boringssl/src/crypto/x509/t_x509.c +280 -251
- package/third_party/boringssl/src/crypto/x509/t_x509a.c +52 -47
- package/third_party/boringssl/src/crypto/x509/x509.c +3 -4
- package/third_party/boringssl/src/crypto/x509/x509_att.c +234 -223
- package/third_party/boringssl/src/crypto/x509/x509_cmp.c +286 -296
- package/third_party/boringssl/src/crypto/x509/x509_d2.c +37 -32
- package/third_party/boringssl/src/crypto/x509/x509_def.c +14 -30
- package/third_party/boringssl/src/crypto/x509/x509_ext.c +55 -84
- package/third_party/boringssl/src/crypto/x509/x509_lu.c +545 -581
- package/third_party/boringssl/src/crypto/x509/x509_obj.c +131 -121
- package/third_party/boringssl/src/crypto/x509/x509_req.c +120 -139
- package/third_party/boringssl/src/crypto/x509/x509_set.c +128 -142
- package/third_party/boringssl/src/crypto/x509/x509_trs.c +185 -193
- package/third_party/boringssl/src/crypto/x509/x509_txt.c +70 -72
- package/third_party/boringssl/src/crypto/x509/x509_v3.c +172 -161
- package/third_party/boringssl/src/crypto/x509/x509_vfy.c +2041 -2053
- package/third_party/boringssl/src/crypto/x509/x509_vpm.c +441 -461
- package/third_party/boringssl/src/crypto/x509/x509cset.c +152 -170
- package/third_party/boringssl/src/crypto/x509/x509name.c +274 -260
- package/third_party/boringssl/src/crypto/x509/x509rset.c +43 -20
- package/third_party/boringssl/src/crypto/x509/x509spki.c +62 -63
- package/third_party/boringssl/src/crypto/x509/x_algor.c +64 -62
- package/third_party/boringssl/src/crypto/x509/x_all.c +103 -133
- package/third_party/boringssl/src/crypto/x509/x_attrib.c +23 -24
- package/third_party/boringssl/src/crypto/x509/x_crl.c +310 -321
- package/third_party/boringssl/src/crypto/x509/x_exten.c +6 -5
- package/third_party/boringssl/src/crypto/x509/x_info.c +31 -28
- package/third_party/boringssl/src/crypto/x509/x_name.c +361 -365
- package/third_party/boringssl/src/crypto/x509/x_pkey.c +38 -32
- package/third_party/boringssl/src/crypto/x509/x_pubkey.c +114 -117
- package/third_party/boringssl/src/crypto/x509/x_req.c +27 -29
- package/third_party/boringssl/src/crypto/x509/x_sig.c +2 -2
- package/third_party/boringssl/src/crypto/x509/x_spki.c +8 -10
- package/third_party/boringssl/src/crypto/x509/x_val.c +2 -2
- package/third_party/boringssl/src/crypto/x509/x_x509.c +212 -226
- package/third_party/boringssl/src/crypto/x509/x_x509a.c +112 -109
- package/third_party/boringssl/src/crypto/x509v3/ext_dat.h +10 -13
- package/third_party/boringssl/src/crypto/x509v3/internal.h +72 -87
- package/third_party/boringssl/src/crypto/x509v3/pcy_cache.c +184 -176
- package/third_party/boringssl/src/crypto/x509v3/pcy_data.c +58 -56
- package/third_party/boringssl/src/crypto/x509v3/pcy_lib.c +71 -70
- package/third_party/boringssl/src/crypto/x509v3/pcy_map.c +56 -58
- package/third_party/boringssl/src/crypto/x509v3/pcy_node.c +89 -91
- package/third_party/boringssl/src/crypto/x509v3/pcy_tree.c +585 -590
- package/third_party/boringssl/src/crypto/x509v3/v3_akey.c +118 -112
- package/third_party/boringssl/src/crypto/x509v3/v3_akeya.c +3 -3
- package/third_party/boringssl/src/crypto/x509v3/v3_alt.c +447 -451
- package/third_party/boringssl/src/crypto/x509v3/v3_bcons.c +44 -38
- package/third_party/boringssl/src/crypto/x509v3/v3_bitst.c +39 -43
- package/third_party/boringssl/src/crypto/x509v3/v3_conf.c +321 -320
- package/third_party/boringssl/src/crypto/x509v3/v3_cpols.c +352 -327
- package/third_party/boringssl/src/crypto/x509v3/v3_crld.c +437 -383
- package/third_party/boringssl/src/crypto/x509v3/v3_enum.c +23 -16
- package/third_party/boringssl/src/crypto/x509v3/v3_extku.c +62 -53
- package/third_party/boringssl/src/crypto/x509v3/v3_genn.c +118 -115
- package/third_party/boringssl/src/crypto/x509v3/v3_ia5.c +30 -31
- package/third_party/boringssl/src/crypto/x509v3/v3_info.c +112 -98
- package/third_party/boringssl/src/crypto/x509v3/v3_int.c +40 -15
- package/third_party/boringssl/src/crypto/x509v3/v3_lib.c +248 -252
- package/third_party/boringssl/src/crypto/x509v3/v3_ncons.c +390 -386
- package/third_party/boringssl/src/crypto/x509v3/v3_ocsp.c +45 -32
- package/third_party/boringssl/src/crypto/x509v3/v3_pci.c +206 -209
- package/third_party/boringssl/src/crypto/x509v3/v3_pcia.c +6 -8
- package/third_party/boringssl/src/crypto/x509v3/v3_pcons.c +54 -50
- package/third_party/boringssl/src/crypto/x509v3/v3_pmaps.c +66 -65
- package/third_party/boringssl/src/crypto/x509v3/v3_prn.c +144 -133
- package/third_party/boringssl/src/crypto/x509v3/v3_purp.c +695 -709
- package/third_party/boringssl/src/crypto/x509v3/v3_skey.c +75 -69
- package/third_party/boringssl/src/crypto/x509v3/v3_utl.c +1102 -1082
- package/third_party/boringssl/src/include/openssl/base.h +3 -1
- package/third_party/boringssl/src/include/openssl/bn.h +3 -0
- package/third_party/boringssl/src/include/openssl/bytestring.h +20 -0
- package/third_party/boringssl/src/include/openssl/evp.h +6 -5
- package/third_party/boringssl/src/include/openssl/kdf.h +91 -0
- package/third_party/boringssl/src/include/openssl/nid.h +4 -0
- package/third_party/boringssl/src/include/openssl/ssl.h +6 -1
- package/third_party/boringssl/src/include/openssl/stack.h +47 -32
- package/third_party/boringssl/src/include/openssl/trust_token.h +18 -3
- package/third_party/boringssl/src/include/openssl/x509.h +18 -0
- package/third_party/boringssl/src/ssl/ssl_file.cc +61 -99
- package/third_party/boringssl/src/ssl/ssl_test.cc +101 -0
- package/third_party/boringssl/src/util/doc.config +2 -1
- package/third_party/boringssl/src/util/fipstools/acvp/acvptool/subprocess/subprocess.go +8 -0
- package/third_party/googleurl/AUTHORS +16 -2
- package/third_party/googleurl/base/BUILD +1 -0
- package/third_party/googleurl/base/compiler_specific.h +16 -17
- package/third_party/googleurl/base/containers/contiguous_iterator.h +13 -9
- package/third_party/googleurl/base/containers/span.h +23 -8
- package/third_party/googleurl/base/memory/raw_ptr.h +17 -25
- package/third_party/googleurl/base/memory/raw_ptr_exclusion.h +21 -0
- package/third_party/googleurl/base/strings/escape.cc +14 -2
- package/third_party/googleurl/base/strings/safe_sprintf.h +1 -1
- package/third_party/googleurl/base/strings/string_number_conversions.cc +5 -3
- package/third_party/googleurl/base/strings/string_number_conversions_internal.h +5 -5
- package/third_party/googleurl/base/strings/string_piece.h +3 -3
- package/third_party/googleurl/base/strings/string_util.cc +4 -27
- package/third_party/googleurl/base/strings/string_util.h +43 -8
- package/third_party/googleurl/base/strings/string_util_internal.h +11 -12
- package/third_party/googleurl/base/strings/string_util_unittest.cc +33 -0
- package/third_party/googleurl/base/strings/string_util_win.cc +0 -5
- package/third_party/googleurl/base/strings/string_util_win.h +9 -1
- package/third_party/googleurl/base/strings/utf_offset_string_conversions.cc +1 -1
- package/third_party/googleurl/base/strings/utf_string_conversion_utils.cc +5 -8
- package/third_party/googleurl/base/strings/utf_string_conversion_utils.h +13 -10
- package/third_party/googleurl/base/strings/utf_string_conversions.cc +32 -25
- package/third_party/googleurl/base/template_util.h +23 -35
- package/third_party/googleurl/build/build_config.h +14 -3
- package/third_party/googleurl/copy.bara.sky +1 -1
- package/third_party/googleurl/url/gurl.cc +8 -4
- package/third_party/googleurl/url/gurl.h +1 -0
- package/third_party/googleurl/url/gurl_unittest.cc +1 -0
- package/third_party/googleurl/url/origin.h +36 -26
- package/third_party/googleurl/url/scheme_host_port.h +4 -1
- package/third_party/googleurl/url/url_canon.h +2 -1
- package/third_party/googleurl/url/url_canon_internal.cc +9 -7
- package/third_party/googleurl/url/url_canon_internal.h +16 -16
- package/third_party/googleurl/url/url_canon_stdstring.h +2 -1
- package/third_party/googleurl/url/url_util.cc +9 -8
- package/third_party/quiche/build/source_list.bzl +7 -0
- package/third_party/quiche/build/source_list.gni +7 -0
- package/third_party/quiche/build/source_list.json +7 -0
- package/third_party/quiche/quiche/common/platform/api/quiche_mem_slice.h +7 -3
- package/third_party/quiche/quiche/http2/adapter/nghttp2_adapter_test.cc +86 -2
- package/third_party/quiche/quiche/http2/adapter/oghttp2_adapter_test.cc +104 -2
- package/third_party/quiche/quiche/http2/adapter/oghttp2_session.cc +23 -0
- package/third_party/quiche/quiche/http2/adapter/oghttp2_session.h +6 -1
- package/third_party/quiche/quiche/quic/core/congestion_control/send_algorithm_test.cc +0 -16
- package/third_party/quiche/quiche/quic/core/crypto/crypto_protocol.h +1 -1
- package/third_party/quiche/quiche/quic/core/http/end_to_end_test.cc +56 -2
- package/third_party/quiche/quiche/quic/core/http/http_constants.cc +1 -0
- package/third_party/quiche/quiche/quic/core/http/http_constants.h +1 -0
- package/third_party/quiche/quiche/quic/core/http/http_encoder.cc +28 -17
- package/third_party/quiche/quiche/quic/core/http/http_encoder.h +5 -0
- package/third_party/quiche/quiche/quic/core/http/http_encoder_test.cc +26 -30
- package/third_party/quiche/quiche/quic/core/http/http_frames.h +1 -0
- package/third_party/quiche/quiche/quic/core/http/quic_server_session_base.cc +4 -4
- package/third_party/quiche/quiche/quic/core/http/quic_server_session_base_test.cc +1 -1
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_client_session.cc +5 -1
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.cc +6 -33
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream.h +0 -17
- package/third_party/quiche/quiche/quic/core/http/quic_spdy_stream_test.cc +5 -20
- package/third_party/quiche/quiche/quic/core/io/quic_event_loop.h +81 -0
- package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop.cc +265 -0
- package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop.h +152 -0
- package/third_party/quiche/quiche/quic/core/io/quic_poll_event_loop_test.cc +341 -0
- package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store.cc +3 -1
- package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store.h +7 -7
- package/third_party/quiche/quiche/quic/core/quic_buffered_packet_store_test.cc +4 -3
- package/third_party/quiche/quiche/quic/core/quic_connection.cc +69 -19
- package/third_party/quiche/quiche/quic/core/quic_connection.h +9 -3
- package/third_party/quiche/quiche/quic/core/quic_connection_id_manager.cc +29 -10
- package/third_party/quiche/quiche/quic/core/quic_connection_id_manager.h +5 -3
- package/third_party/quiche/quiche/quic/core/quic_connection_id_manager_test.cc +85 -22
- package/third_party/quiche/quiche/quic/core/quic_connection_test.cc +186 -30
- package/third_party/quiche/quiche/quic/core/quic_crypto_stream.cc +2 -1
- package/third_party/quiche/quiche/quic/core/quic_default_clock.cc +31 -0
- package/third_party/quiche/quiche/quic/core/quic_default_clock.h +34 -0
- package/third_party/quiche/quiche/quic/core/quic_default_connection_helper.h +49 -0
- package/third_party/quiche/quiche/quic/core/quic_dispatcher.cc +53 -37
- package/third_party/quiche/quiche/quic/core/quic_dispatcher.h +19 -11
- package/third_party/quiche/quiche/quic/core/quic_dispatcher_test.cc +15 -2
- package/third_party/quiche/quiche/quic/core/quic_flags_list.h +10 -4
- package/third_party/quiche/quiche/quic/core/quic_idle_network_detector.cc +2 -2
- package/third_party/quiche/quiche/quic/core/quic_idle_network_detector_test.cc +4 -4
- package/third_party/quiche/quiche/quic/core/quic_packet_creator.cc +14 -3
- package/third_party/quiche/quiche/quic/core/quic_packet_creator_test.cc +145 -2
- package/third_party/quiche/quiche/quic/core/quic_packets.cc +3 -1
- package/third_party/quiche/quiche/quic/core/quic_packets.h +4 -0
- package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.cc +13 -11
- package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager.h +9 -0
- package/third_party/quiche/quiche/quic/core/quic_sent_packet_manager_test.cc +6 -0
- package/third_party/quiche/quiche/quic/core/quic_session.cc +3 -2
- package/third_party/quiche/quiche/quic/core/quic_session.h +8 -3
- package/third_party/quiche/quiche/quic/core/quic_types.cc +18 -0
- package/third_party/quiche/quiche/quic/core/quic_types.h +3 -0
- package/third_party/quiche/quiche/quic/core/tls_chlo_extractor.cc +3 -0
- package/third_party/quiche/quiche/quic/core/tls_chlo_extractor.h +10 -0
- package/third_party/quiche/quiche/quic/test_tools/mock_quic_session_visitor.h +1 -1
- package/third_party/quiche/quiche/quic/test_tools/quic_test_utils.h +1 -1
- package/third_party/quiche/quiche/quic/test_tools/server_thread.cc +3 -2
- package/third_party/quiche/quiche/quic/test_tools/simple_session_notifier.cc +7 -1
- package/third_party/quiche/quiche/quic/test_tools/simple_session_notifier.h +3 -0
- package/third_party/quiche/quiche/quic/test_tools/simulator/quic_endpoint.h +4 -2
- package/certs/ca.cnf +0 -69
- package/certs/generate_certs.sh +0 -53
- package/certs/generate_certs_leaf.sh +0 -53
- package/certs/leaf.cnf +0 -24
- package/certs/readme.txt +0 -2
- package/third_party/quiche/build/BUILD.bazel +0 -7
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -36,14 +36,12 @@ In this case you need to be authenticated against github.
|
|
|
36
36
|
|
|
37
37
|
If you are running the install as root, you need to use `--unsafe-perm` as flag.
|
|
38
38
|
Installing the package requires a full building environment including clang-9, perl6, golang, ninja-build and protobuf-compiler and protobuf headers. See the `Dockerfile` or `Dockerfile.development` for required debian packages.
|
|
39
|
-
This should work for linux and Mac OS X. Windows is not supported, since cmake.js only works with msvc and some libraries require clang, I recommend a Docker container instead. Of course, PR for patches and for compiling instructions and necessary changes are welcome for all possible environments.
|
|
39
|
+
This should work for linux and Mac OS X. Windows is currently not supported, since cmake.js only works with msvc and some libraries require clang, I recommend a Docker container instead. Of course, PR for patches and for compiling instructions and necessary changes are welcome for all possible environments.
|
|
40
40
|
|
|
41
41
|
Warning the build time takes more than 10 minutes!
|
|
42
42
|
|
|
43
43
|
In the directory `test` you find a simple echo server code. That answers to a series of WebTransport echos. Furthermore some example browser code and finally a unit test of the library including certificate generation.
|
|
44
44
|
|
|
45
|
-
In the directory `certs` some scripts for generating test certificates, originally taken from chromium, libquiche project are provided. However the certicate generation code in the unit test is recommended.
|
|
46
|
-
|
|
47
45
|
When testing remember you might need to start chromium based browser with certain flags to accept your http/3 certificate with errors, e.g.:
|
|
48
46
|
```
|
|
49
47
|
chrome --ignore-certificate-errors-spki-list=FINGERPRINTOFYOURCERTIFICATE --ignore-certificate-errors --v=2 --enable-logging=stderr --origin-to-force-quic-on=192.168.1.50:8080
|
package/src/http3eventloop.cc
CHANGED
|
@@ -89,8 +89,9 @@ namespace quic
|
|
|
89
89
|
tplwtsv->SetClassName(Nan::New("Http3WTStream").ToLocalChecked());
|
|
90
90
|
tplwtsv->InstanceTemplate()->SetInternalFieldCount(1);
|
|
91
91
|
Nan::SetPrototypeMethod(tplwtsv, "writeChunk", Http3WTStream::writeChunk);
|
|
92
|
-
Nan::SetPrototypeMethod(tplwtsv, "closeStream", Http3WTStream::closeStream);
|
|
93
92
|
Nan::SetPrototypeMethod(tplwtsv, "resetStream", Http3WTStream::resetStream);
|
|
93
|
+
Nan::SetPrototypeMethod(tplwtsv, "stopSending", Http3WTStream::stopSending);
|
|
94
|
+
Nan::SetPrototypeMethod(tplwtsv, "streamFinal", Http3WTStream::streamFinal);
|
|
94
95
|
Nan::SetPrototypeMethod(tplwtsv, "startReading", Http3WTStream::startReading);
|
|
95
96
|
Nan::SetPrototypeMethod(tplwtsv, "stopReading", Http3WTStream::stopReading);
|
|
96
97
|
|
|
@@ -177,12 +178,13 @@ namespace quic
|
|
|
177
178
|
progress_->Send(&report, 1);
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
void Http3EventLoop::
|
|
181
|
+
void Http3EventLoop::informStreamRecvSignal(Http3WTStream *streamobj, WebTransportStreamError error_code, NetworkTask task)
|
|
181
182
|
{
|
|
182
183
|
struct Http3ProgressReport report;
|
|
183
|
-
report.type = Http3ProgressReport::
|
|
184
|
+
report.type = Http3ProgressReport::StreamRecvSignal;
|
|
184
185
|
report.streamobj = streamobj;
|
|
185
|
-
report.wtscode =
|
|
186
|
+
report.wtscode = error_code;
|
|
187
|
+
report.nettask = task;
|
|
186
188
|
if (progress_)
|
|
187
189
|
progress_->Send(&report, 1);
|
|
188
190
|
}
|
|
@@ -209,6 +211,17 @@ namespace quic
|
|
|
209
211
|
progress_->Send(&report, 1);
|
|
210
212
|
}
|
|
211
213
|
|
|
214
|
+
void Http3EventLoop::informAboutStreamNetworkFinish(Http3WTStream *streamobj, NetworkTask task)
|
|
215
|
+
{
|
|
216
|
+
struct Http3ProgressReport report;
|
|
217
|
+
report.type = Http3ProgressReport::StreamNetworkFinish;
|
|
218
|
+
report.streamobj = streamobj;
|
|
219
|
+
report.nettask = task;
|
|
220
|
+
if (progress_)
|
|
221
|
+
progress_->Send(&report, 1);
|
|
222
|
+
|
|
223
|
+
}
|
|
224
|
+
|
|
212
225
|
void Http3EventLoop::informAboutStreamReset(Http3WTStream *streamobj)
|
|
213
226
|
{
|
|
214
227
|
struct Http3ProgressReport report;
|
|
@@ -399,22 +412,41 @@ namespace quic
|
|
|
399
412
|
Nan::Call(*cbsession_, 1, argv);
|
|
400
413
|
}
|
|
401
414
|
|
|
402
|
-
void Http3EventLoop::
|
|
415
|
+
void Http3EventLoop::processStreamRecvSignal(Http3WTStream *streamobj, WebTransportStreamError error_code, NetworkTask task)
|
|
403
416
|
{
|
|
404
417
|
HandleScope scope;
|
|
405
418
|
v8::Local<v8::String> purposeProp = Nan::New("purpose").ToLocalChecked();
|
|
406
|
-
v8::Local<v8::String> purposeVal = Nan::New("
|
|
419
|
+
v8::Local<v8::String> purposeVal = Nan::New("StreamRecvSignal").ToLocalChecked();
|
|
407
420
|
v8::Local<v8::String> codeProp = Nan::New("code").ToLocalChecked();
|
|
408
|
-
v8::Local<v8::Int32> codeVal = Nan::New(
|
|
421
|
+
v8::Local<v8::Int32> codeVal = Nan::New(error_code);
|
|
409
422
|
|
|
410
423
|
v8::Local<v8::String> objProp = Nan::New("object").ToLocalChecked();
|
|
411
424
|
v8::Local<v8::Object> objVal = streamobj->handle();
|
|
412
425
|
|
|
426
|
+
std::string nettaskstr;
|
|
427
|
+
switch (task)
|
|
428
|
+
{
|
|
429
|
+
case NetworkTask::resetStream: {
|
|
430
|
+
nettaskstr = "resetStream";
|
|
431
|
+
} break;
|
|
432
|
+
case NetworkTask::stopSending: {
|
|
433
|
+
nettaskstr = "stopSending";
|
|
434
|
+
} break;
|
|
435
|
+
case NetworkTask::streamFinal: {
|
|
436
|
+
nettaskstr = "streamFinal";
|
|
437
|
+
} break;
|
|
438
|
+
default: return;
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
v8::Local<v8::String> nettaskProp = Nan::New("nettask").ToLocalChecked();
|
|
442
|
+
v8::Local<v8::String> nettaskVal = Nan::New(nettaskstr).ToLocalChecked();
|
|
443
|
+
|
|
413
444
|
auto context = GetCurrentContext();
|
|
414
445
|
v8::Local<v8::Object> retObj = Nan::New<v8::Object>();
|
|
415
446
|
retObj->Set(context, purposeProp, purposeVal).FromJust();
|
|
416
447
|
retObj->Set(context, codeProp, codeVal).FromJust();
|
|
417
448
|
retObj->Set(context, objProp, objVal).FromJust();
|
|
449
|
+
retObj->Set(context, nettaskProp, nettaskVal).FromJust();
|
|
418
450
|
|
|
419
451
|
v8::Local<v8::Value> argv[] = {retObj};
|
|
420
452
|
Nan::Call(*cbstream_, 1, argv);
|
|
@@ -489,6 +521,44 @@ namespace quic
|
|
|
489
521
|
Nan::Call(*cbstream_, 1, argv);
|
|
490
522
|
}
|
|
491
523
|
|
|
524
|
+
void Http3EventLoop::processStreamNetworkFinish(Http3WTStream *streamobj, NetworkTask task)
|
|
525
|
+
{
|
|
526
|
+
HandleScope scope;
|
|
527
|
+
v8::Local<v8::String> purposeProp = Nan::New("purpose").ToLocalChecked();
|
|
528
|
+
v8::Local<v8::String> purposeVal = Nan::New("StreamNetworkFinish").ToLocalChecked();
|
|
529
|
+
|
|
530
|
+
v8::Local<v8::String> objProp = Nan::New("object").ToLocalChecked();
|
|
531
|
+
v8::Local<v8::Object> objVal = streamobj->handle();
|
|
532
|
+
|
|
533
|
+
std::string nettaskstr;
|
|
534
|
+
switch (task)
|
|
535
|
+
{
|
|
536
|
+
case NetworkTask::resetStream: {
|
|
537
|
+
nettaskstr = "resetStream";
|
|
538
|
+
} break;
|
|
539
|
+
case NetworkTask::stopSending: {
|
|
540
|
+
nettaskstr = "stopSending";
|
|
541
|
+
} break;
|
|
542
|
+
case NetworkTask::streamFinal: {
|
|
543
|
+
nettaskstr = "streamFinal";
|
|
544
|
+
} break;
|
|
545
|
+
default: return;
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
v8::Local<v8::String> nettaskProp = Nan::New("nettask").ToLocalChecked();
|
|
549
|
+
v8::Local<v8::String> nettaskVal = Nan::New(nettaskstr).ToLocalChecked();
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
auto context = GetCurrentContext();
|
|
553
|
+
v8::Local<v8::Object> retObj = Nan::New<v8::Object>();
|
|
554
|
+
retObj->Set(context, purposeProp, purposeVal).FromJust();
|
|
555
|
+
retObj->Set(context, objProp, objVal).FromJust();
|
|
556
|
+
retObj->Set(context, nettaskProp, nettaskVal).FromJust();
|
|
557
|
+
|
|
558
|
+
v8::Local<v8::Value> argv[] = {retObj};
|
|
559
|
+
Nan::Call(*cbstream_, 1, argv);
|
|
560
|
+
}
|
|
561
|
+
|
|
492
562
|
void Http3EventLoop::processDatagramBufferFree(Nan::Persistent<v8::Object> *bufferhandle)
|
|
493
563
|
{
|
|
494
564
|
bufferhandle->Reset(); // release the outgoing buffer
|
|
@@ -688,9 +758,9 @@ namespace quic
|
|
|
688
758
|
processStream(false, false, cur.sessionobj, cur.stream);
|
|
689
759
|
}
|
|
690
760
|
break;
|
|
691
|
-
case Http3ProgressReport::
|
|
761
|
+
case Http3ProgressReport::StreamRecvSignal:
|
|
692
762
|
{
|
|
693
|
-
|
|
763
|
+
processStreamRecvSignal(cur.streamobj, cur.wtscode, cur.nettask);
|
|
694
764
|
}
|
|
695
765
|
break;
|
|
696
766
|
case Http3ProgressReport::StreamRead:
|
|
@@ -709,6 +779,10 @@ namespace quic
|
|
|
709
779
|
processStreamReset(cur.streamobj);
|
|
710
780
|
}
|
|
711
781
|
break;
|
|
782
|
+
case Http3ProgressReport::StreamNetworkFinish:
|
|
783
|
+
{
|
|
784
|
+
processStreamNetworkFinish(cur.streamobj, cur.nettask);
|
|
785
|
+
} break;
|
|
712
786
|
case Http3ProgressReport::DatagramReceived:
|
|
713
787
|
{
|
|
714
788
|
processDatagramReceived(cur.sessionobj, cur.para);
|
package/src/http3eventloop.h
CHANGED
|
@@ -37,6 +37,12 @@ namespace quic
|
|
|
37
37
|
virtual void doUnref() = 0;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
enum NetworkTask {
|
|
41
|
+
resetStream,
|
|
42
|
+
stopSending,
|
|
43
|
+
streamFinal
|
|
44
|
+
};
|
|
45
|
+
|
|
40
46
|
|
|
41
47
|
struct Http3ProgressReport
|
|
42
48
|
{
|
|
@@ -53,10 +59,11 @@ namespace quic
|
|
|
53
59
|
IncomUniDiStream,
|
|
54
60
|
OutgoBiDiStream,
|
|
55
61
|
OutgoUniDiStream,
|
|
56
|
-
|
|
62
|
+
StreamRecvSignal,
|
|
57
63
|
StreamRead,
|
|
58
64
|
StreamWrite,
|
|
59
65
|
StreamReset,
|
|
66
|
+
StreamNetworkFinish,
|
|
60
67
|
DatagramReceived,
|
|
61
68
|
DatagramSend,
|
|
62
69
|
DatagramBufferFree,
|
|
@@ -72,6 +79,7 @@ namespace quic
|
|
|
72
79
|
union
|
|
73
80
|
{
|
|
74
81
|
WebTransportSessionError wtecode;
|
|
82
|
+
NetworkTask nettask;
|
|
75
83
|
};
|
|
76
84
|
union
|
|
77
85
|
{
|
|
@@ -127,10 +135,11 @@ namespace quic
|
|
|
127
135
|
void informSessionReady(Http3WTSession *sessionobj);
|
|
128
136
|
|
|
129
137
|
void informAboutStream(bool incom, bool bidir, Http3WTSession *sessionobj, Http3WTStream *stream);
|
|
130
|
-
void
|
|
138
|
+
void informStreamRecvSignal(Http3WTStream *streamobj, WebTransportStreamError error_code, NetworkTask task);
|
|
131
139
|
void informAboutStreamRead(Http3WTStream *streamobj, std::string *data, bool fin);
|
|
132
140
|
void informAboutStreamWrite(Http3WTStream *streamobj, Nan::Persistent<v8::Object> *bufferhandle, bool success);
|
|
133
141
|
void informAboutStreamReset(Http3WTStream *streamobj);
|
|
142
|
+
void informAboutStreamNetworkFinish(Http3WTStream *streamobj, NetworkTask task);
|
|
134
143
|
|
|
135
144
|
void informDatagramReceived(Http3WTSession *sessionobj, absl::string_view datagram);
|
|
136
145
|
void informDatagramBufferFree(Nan::Persistent<v8::Object> *bufferhandle);
|
|
@@ -177,10 +186,11 @@ namespace quic
|
|
|
177
186
|
void processSessionReady(Http3WTSession *sessionobj);
|
|
178
187
|
|
|
179
188
|
void processStream(bool incom, bool bidi, Http3WTSession *sessionobj, Http3WTStream *stream);
|
|
180
|
-
void
|
|
189
|
+
void processStreamRecvSignal(Http3WTStream *streamobj, WebTransportStreamError error_code, NetworkTask task);
|
|
181
190
|
void processStreamRead(Http3WTStream *streamobj, std::string *data, bool fin);
|
|
182
191
|
void processStreamWrite(Http3WTStream *streamobj, Nan::Persistent<v8::Object> *bufferhandle, bool success);
|
|
183
192
|
void processStreamReset(Http3WTStream *streamobj);
|
|
193
|
+
void processStreamNetworkFinish(Http3WTStream *streamobj, NetworkTask task);
|
|
184
194
|
|
|
185
195
|
void processDatagramReceived(Http3WTSession *sessionobj, std::string *datagram);
|
|
186
196
|
void processDatagramSend(Http3WTSession *sessionobj);
|
package/src/http3server.cc
CHANGED
|
@@ -26,11 +26,12 @@ namespace quic
|
|
|
26
26
|
|
|
27
27
|
const size_t kNumSessionsToCreatePerSocketEvent = 16;
|
|
28
28
|
|
|
29
|
-
Http3Server::Http3Server(Http3EventLoop *
|
|
30
|
-
const char *secret)
|
|
29
|
+
Http3Server::Http3Server(Http3EventLoop *eventloop, std::string host, int port, std::unique_ptr<ProofSource> proof_source,
|
|
30
|
+
const char *secret, QuicConfig config)
|
|
31
31
|
: port_(port), host_(host), fd_(-1), overflow_supported_(false),
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
config_(config),
|
|
33
|
+
eventloop_(eventloop),
|
|
34
|
+
http3_server_backend_(eventloop),
|
|
34
35
|
packet_reader_(new QuicPacketReader()),
|
|
35
36
|
packets_dropped_(0),
|
|
36
37
|
version_manager_({ParsedQuicVersion::RFCv1()}),
|
|
@@ -47,8 +48,6 @@ namespace quic
|
|
|
47
48
|
// printf("server destruct %x\n", this);
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
51
|
bool Http3Server::CreateUDPSocketAndListen(const QuicSocketAddress &address)
|
|
53
52
|
{
|
|
54
53
|
QuicUdpSocketApi socket_api;
|
|
@@ -97,7 +96,7 @@ namespace quic
|
|
|
97
96
|
|
|
98
97
|
bool Http3Server::stopServerInt()
|
|
99
98
|
{
|
|
100
|
-
|
|
99
|
+
|
|
101
100
|
eventloop_->getEpollServer()->UnregisterFD(fd_);
|
|
102
101
|
|
|
103
102
|
// if (!silent_close_) {
|
|
@@ -106,7 +105,6 @@ namespace quic
|
|
|
106
105
|
dispatcher_->Shutdown();
|
|
107
106
|
//}
|
|
108
107
|
|
|
109
|
-
|
|
110
108
|
close(fd_);
|
|
111
109
|
fd_ = -1;
|
|
112
110
|
eventloop_->informUnref(this); // must be done on the other thread...
|
|
@@ -127,8 +125,6 @@ namespace quic
|
|
|
127
125
|
&http3_server_backend_, expected_server_connection_id_length_);
|
|
128
126
|
}
|
|
129
127
|
|
|
130
|
-
|
|
131
|
-
|
|
132
128
|
NAN_METHOD(Http3Server::New)
|
|
133
129
|
{
|
|
134
130
|
if (info.IsConstructCall())
|
|
@@ -140,10 +136,10 @@ namespace quic
|
|
|
140
136
|
std::string privkey;
|
|
141
137
|
std::string host("localhost");
|
|
142
138
|
|
|
143
|
-
|
|
144
|
-
|
|
145
139
|
v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
|
|
140
|
+
|
|
146
141
|
|
|
142
|
+
QuicConfig sconfig;
|
|
147
143
|
if (!info[0]->IsUndefined())
|
|
148
144
|
{
|
|
149
145
|
v8::MaybeLocal<v8::Object> obj = info[0]->ToObject(context);
|
|
@@ -152,6 +148,7 @@ namespace quic
|
|
|
152
148
|
v8::Local<v8::String> certProp = Nan::New("cert").ToLocalChecked();
|
|
153
149
|
v8::Local<v8::String> hostProp = Nan::New("host").ToLocalChecked();
|
|
154
150
|
v8::Local<v8::String> keyProp = Nan::New("privKey").ToLocalChecked();
|
|
151
|
+
v8::Local<v8::String> maxconnProp = Nan::New("maxConnections").ToLocalChecked();
|
|
155
152
|
if (!obj.IsEmpty())
|
|
156
153
|
{
|
|
157
154
|
v8::Local<v8::Object> lobj = obj.ToLocalChecked();
|
|
@@ -192,6 +189,14 @@ namespace quic
|
|
|
192
189
|
{
|
|
193
190
|
return Nan::ThrowError("No privKey set for Http3Server");
|
|
194
191
|
}
|
|
192
|
+
if (Nan::HasOwnProperty(lobj, maxconnProp).FromJust() && !Nan::Get(lobj, keyProp).IsEmpty())
|
|
193
|
+
{
|
|
194
|
+
v8::Local<v8::Value> maxconnValue = Nan::Get(lobj, keyProp).ToLocalChecked();
|
|
195
|
+
int maxconn = Nan::To<int>(maxconnValue).FromJust();
|
|
196
|
+
sconfig.SetMaxBidirectionalStreamsToSend(maxconn);
|
|
197
|
+
sconfig.SetMaxUnidirectionalStreamsToSend(maxconn);
|
|
198
|
+
}
|
|
199
|
+
|
|
195
200
|
}
|
|
196
201
|
// Callback *callback, int port, std::unique_ptr<ProofSource> proof_source, const char *secret
|
|
197
202
|
|
|
@@ -207,20 +212,19 @@ namespace quic
|
|
|
207
212
|
std::unique_ptr<ProofSourceX509> proofsource = ProofSourceX509::Create(chain, std::move(*certprivkey));
|
|
208
213
|
if (proofsource == nullptr)
|
|
209
214
|
return Nan::ThrowError("LoadPemFromStream cert failed for Http3Server");
|
|
210
|
-
Http3EventLoop *
|
|
215
|
+
Http3EventLoop *eventloop = nullptr;
|
|
211
216
|
if (!info[1]->IsUndefined())
|
|
212
217
|
{
|
|
213
218
|
v8::MaybeLocal<v8::Object> obj = info[1]->ToObject(context);
|
|
214
219
|
v8::Local<v8::Object> lobj = obj.ToLocalChecked();
|
|
215
220
|
eventloop = Nan::ObjectWrap::Unwrap<Http3EventLoop>(lobj);
|
|
216
|
-
}
|
|
217
|
-
else
|
|
221
|
+
}
|
|
222
|
+
else
|
|
218
223
|
{
|
|
219
224
|
return Nan::ThrowError("No eventloop arguments passed to Http3Server");
|
|
220
225
|
}
|
|
221
226
|
|
|
222
|
-
|
|
223
|
-
Http3Server *object = new Http3Server(eventloop, host, port, std::move(proofsource), secret.c_str());
|
|
227
|
+
Http3Server *object = new Http3Server(eventloop, host, port, std::move(proofsource), secret.c_str(), sconfig);
|
|
224
228
|
object->Wrap(info.This());
|
|
225
229
|
info.GetReturnValue().Set(info.This());
|
|
226
230
|
}
|
|
@@ -228,12 +232,11 @@ namespace quic
|
|
|
228
232
|
{
|
|
229
233
|
return Nan::ThrowError("No arguments passed to Http3Server");
|
|
230
234
|
}
|
|
231
|
-
|
|
232
235
|
}
|
|
233
236
|
else
|
|
234
237
|
{
|
|
235
238
|
const int argc = 2;
|
|
236
|
-
v8::Local<v8::Value> argv[argc] = {info[0],info[1]};
|
|
239
|
+
v8::Local<v8::Value> argv[argc] = {info[0], info[1]};
|
|
237
240
|
v8::Local<v8::Function> cons = Nan::New(constructor());
|
|
238
241
|
auto instance = Nan::NewInstance(cons, argc, argv);
|
|
239
242
|
if (!instance.IsEmpty())
|
|
@@ -335,7 +338,6 @@ namespace quic
|
|
|
335
338
|
printf("startServerInt failed for Http3Server\n");
|
|
336
339
|
} };
|
|
337
340
|
obj->eventloop_->Schedule(task);
|
|
338
|
-
|
|
339
341
|
}
|
|
340
342
|
|
|
341
343
|
NAN_METHOD(Http3Server::stopServer)
|
|
@@ -348,7 +350,6 @@ namespace quic
|
|
|
348
350
|
printf("stopServerInt failed for Http3Server\n");
|
|
349
351
|
} };
|
|
350
352
|
obj->eventloop_->Schedule(task);
|
|
351
|
-
|
|
352
353
|
}
|
|
353
354
|
|
|
354
355
|
NAN_METHOD(Http3Server::addPath)
|
|
@@ -363,7 +364,6 @@ namespace quic
|
|
|
363
364
|
std::string lpath(*v8::String::Utf8Value(isolate, info[0]->ToString(context).ToLocalChecked()));
|
|
364
365
|
std::function<void()> task = [obj, lpath]()
|
|
365
366
|
{
|
|
366
|
-
|
|
367
367
|
obj->http3_server_backend_.addPath(lpath);
|
|
368
368
|
};
|
|
369
369
|
obj->eventloop_->Schedule(task);
|
package/src/http3server.h
CHANGED
|
@@ -29,30 +29,25 @@ namespace quic
|
|
|
29
29
|
{
|
|
30
30
|
|
|
31
31
|
class Http3EventLoop;
|
|
32
|
-
|
|
33
32
|
|
|
34
33
|
class Http3Server : public QuicEpollCallbackInterface, public Nan::ObjectWrap, public LifetimeHelper
|
|
35
34
|
{
|
|
36
35
|
public:
|
|
37
|
-
Http3Server(Http3EventLoop *
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
Http3Server(Http3EventLoop *eventloop, std::string host, int port,
|
|
37
|
+
std::unique_ptr<ProofSource> proof_source,
|
|
38
|
+
const char *secret,
|
|
39
|
+
QuicConfig config);
|
|
40
40
|
|
|
41
41
|
Http3Server(const Http3Server &) = delete;
|
|
42
42
|
Http3Server &operator=(const Http3Server &) = delete;
|
|
43
43
|
|
|
44
44
|
~Http3Server();
|
|
45
45
|
|
|
46
|
-
|
|
47
46
|
bool CreateUDPSocketAndListen(const QuicSocketAddress &address);
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
48
|
// From EpollCallbackInterface
|
|
53
49
|
std::string Name() const override { return "Http3Server"; }
|
|
54
50
|
|
|
55
|
-
|
|
56
51
|
void OnRegistration(QuicEpollServer * /*eps*/,
|
|
57
52
|
int /*fd*/,
|
|
58
53
|
int /*event_mask*/) override {}
|
|
@@ -70,26 +65,21 @@ namespace quic
|
|
|
70
65
|
|
|
71
66
|
static NAN_METHOD(addPath);
|
|
72
67
|
|
|
73
|
-
|
|
74
68
|
static inline Nan::Persistent<v8::Function> &constructor()
|
|
75
69
|
{
|
|
76
70
|
static Nan::Persistent<v8::Function> my_constructor;
|
|
77
71
|
return my_constructor;
|
|
78
72
|
}
|
|
79
73
|
|
|
80
|
-
void doUnref() override
|
|
74
|
+
void doUnref() override
|
|
75
|
+
{
|
|
81
76
|
Unref();
|
|
82
77
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
78
|
|
|
86
79
|
private:
|
|
87
|
-
|
|
88
80
|
bool startServerInt();
|
|
89
81
|
bool stopServerInt();
|
|
90
82
|
|
|
91
|
-
|
|
92
|
-
|
|
93
83
|
QuicUdpSocketFd fd_;
|
|
94
84
|
bool overflow_supported_;
|
|
95
85
|
int port_;
|
|
@@ -115,10 +105,7 @@ namespace quic
|
|
|
115
105
|
|
|
116
106
|
QuicDispatcher *CreateQuicDispatcher();
|
|
117
107
|
|
|
118
|
-
Http3EventLoop *
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
108
|
+
Http3EventLoop *eventloop_;
|
|
122
109
|
};
|
|
123
110
|
|
|
124
111
|
}
|
|
@@ -24,15 +24,33 @@ namespace quic
|
|
|
24
24
|
strobj->eventloop_->informUnref(strobj);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
void Http3WTStream::Visitor::OnWriteSideInDataRecvdState() // called if everything is written to the client and it is closed
|
|
28
|
+
{
|
|
29
|
+
if (stream_->send_fin_)
|
|
30
|
+
stream_->eventloop_->informAboutStreamNetworkFinish(stream_, NetworkTask::streamFinal);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
void Http3WTStream::Visitor::OnResetStreamReceived(WebTransportStreamError error)
|
|
34
|
+
{
|
|
35
|
+
// should this be removed
|
|
36
|
+
/*
|
|
37
|
+
|
|
38
|
+
// Send FIN in response to a stream reset. We want to test that we can
|
|
39
|
+
// operate one side of the stream cleanly while the other is reset, thus
|
|
40
|
+
// replying with a FIN rather than a RESET_STREAM is more appropriate here.
|
|
41
|
+
stream_->send_fin_ = true;
|
|
42
|
+
OnCanWrite();*/
|
|
43
|
+
lasterror = error;
|
|
44
|
+
stream_->eventloop_->informStreamRecvSignal(stream_, error, NetworkTask::resetStream); // may be move below
|
|
45
|
+
}
|
|
31
46
|
|
|
32
47
|
void Http3WTStream::Visitor::OnStopSendingReceived(WebTransportStreamError error)
|
|
33
48
|
{
|
|
34
49
|
stream_->stop_sending_received_ = true;
|
|
35
|
-
stream_->eventloop_->
|
|
50
|
+
stream_->eventloop_->informStreamRecvSignal(stream_, error, NetworkTask::stopSending); // may be move below
|
|
51
|
+
// we should also finallize the stream, so send a fin
|
|
52
|
+
stream_->send_fin_ = true;
|
|
53
|
+
OnCanWrite();
|
|
36
54
|
}
|
|
37
55
|
|
|
38
56
|
void Http3WTStream::cancelWrite(Nan::Persistent<v8::Object> *handle)
|
|
@@ -42,7 +60,8 @@ namespace quic
|
|
|
42
60
|
|
|
43
61
|
void Http3WTStream::doCanRead()
|
|
44
62
|
{
|
|
45
|
-
if (pause_reading_)
|
|
63
|
+
if (pause_reading_)
|
|
64
|
+
return; // back pressure folks!
|
|
46
65
|
// first figure out if we have readable data
|
|
47
66
|
size_t readable = stream_->ReadableBytes();
|
|
48
67
|
if (readable > 0)
|
|
@@ -60,10 +79,11 @@ namespace quic
|
|
|
60
79
|
|
|
61
80
|
void Http3WTStream::doCanWrite()
|
|
62
81
|
{
|
|
63
|
-
if (stop_sending_received_ || pause_reading_)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
82
|
+
/* if (/* stop_sending_received_ || * pause_reading_)
|
|
83
|
+
{
|
|
84
|
+
return;
|
|
85
|
+
} */
|
|
86
|
+
if (fin_was_sent_) return;
|
|
67
87
|
|
|
68
88
|
while (chunks_.size() > 0)
|
|
69
89
|
{
|
|
@@ -85,6 +105,7 @@ namespace quic
|
|
|
85
105
|
{
|
|
86
106
|
bool success = stream_->SendFin();
|
|
87
107
|
QUICHE_DCHECK(success);
|
|
108
|
+
fin_was_sent_ = true;
|
|
88
109
|
}
|
|
89
110
|
}
|
|
90
111
|
|
|
@@ -51,15 +51,8 @@ namespace quic
|
|
|
51
51
|
stream_->doCanWrite();
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
void OnResetStreamReceived(WebTransportStreamError error) override
|
|
55
|
-
|
|
56
|
-
// Send FIN in response to a stream reset. We want to test that we can
|
|
57
|
-
// operate one side of the stream cleanly while the other is reset, thus
|
|
58
|
-
// replying with a FIN rather than a RESET_STREAM is more appropriate here.
|
|
59
|
-
lasterror = error;
|
|
60
|
-
stream_->send_fin_ = true;
|
|
61
|
-
OnCanWrite();
|
|
62
|
-
}
|
|
54
|
+
void OnResetStreamReceived(WebTransportStreamError error) override;
|
|
55
|
+
|
|
63
56
|
void OnStopSendingReceived(WebTransportStreamError /*error*/) override;
|
|
64
57
|
|
|
65
58
|
void OnWriteSideInDataRecvdState() override;
|
|
@@ -151,7 +144,7 @@ namespace quic
|
|
|
151
144
|
}
|
|
152
145
|
}
|
|
153
146
|
|
|
154
|
-
static NAN_METHOD(
|
|
147
|
+
static NAN_METHOD(streamFinal)
|
|
155
148
|
{
|
|
156
149
|
Http3WTStream *obj = Nan::ObjectWrap::Unwrap<Http3WTStream>(info.Holder());
|
|
157
150
|
std::function<void()> task = [obj]()
|
|
@@ -161,6 +154,30 @@ namespace quic
|
|
|
161
154
|
obj->eventloop_->Schedule(task);
|
|
162
155
|
}
|
|
163
156
|
|
|
157
|
+
static NAN_METHOD(stopSending)
|
|
158
|
+
{
|
|
159
|
+
Http3WTStream *obj = Nan::ObjectWrap::Unwrap<Http3WTStream>(info.Holder());
|
|
160
|
+
int code = 0;
|
|
161
|
+
v8::Isolate *isolate = info.GetIsolate();
|
|
162
|
+
unsigned int reason = 0;
|
|
163
|
+
|
|
164
|
+
if (!info[0]->IsUndefined())
|
|
165
|
+
{
|
|
166
|
+
v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
|
|
167
|
+
v8::Local<v8::Int32> reasonl = info[0]->ToInt32(context).ToLocalChecked();
|
|
168
|
+
reason = Nan::To<unsigned int>(reasonl).FromJust();
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
std::function<void()> task = [obj,reason]()
|
|
173
|
+
{ if (obj->stream_) {
|
|
174
|
+
obj->stream_->SendStopSending(reason);
|
|
175
|
+
obj->eventloop_->informAboutStreamNetworkFinish(obj, NetworkTask::stopSending);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
obj->eventloop_->Schedule(task);
|
|
179
|
+
}
|
|
180
|
+
|
|
164
181
|
static NAN_METHOD(resetStream)
|
|
165
182
|
{
|
|
166
183
|
Http3WTStream *obj = Nan::ObjectWrap::Unwrap<Http3WTStream>(info.Holder());
|
|
@@ -177,7 +194,11 @@ namespace quic
|
|
|
177
194
|
}
|
|
178
195
|
|
|
179
196
|
std::function<void()> task = [obj,reason]()
|
|
180
|
-
{ if (obj->stream_)
|
|
197
|
+
{ if (obj->stream_) {
|
|
198
|
+
obj->stream_->ResetWithUserCode(reason);
|
|
199
|
+
obj->eventloop_->informAboutStreamNetworkFinish(obj, NetworkTask::resetStream);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
181
202
|
obj->eventloop_->Schedule(task);
|
|
182
203
|
}
|
|
183
204
|
|
|
@@ -230,6 +251,11 @@ namespace quic
|
|
|
230
251
|
|
|
231
252
|
void writeChunkInt(char *buffer, size_t len, Nan::Persistent<v8::Object> *bufferhandle)
|
|
232
253
|
{
|
|
254
|
+
if (fin_was_sent_ || send_fin_)
|
|
255
|
+
{
|
|
256
|
+
cancelWrite(bufferhandle);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
233
259
|
if (!stream_)
|
|
234
260
|
{
|
|
235
261
|
cancelWrite(bufferhandle);
|
|
@@ -249,6 +275,7 @@ namespace quic
|
|
|
249
275
|
WebTransportStream *stream_;
|
|
250
276
|
Http3EventLoop *eventloop_;
|
|
251
277
|
bool send_fin_ = false;
|
|
278
|
+
bool fin_was_sent_ = false;
|
|
252
279
|
bool stop_sending_received_ = false;
|
|
253
280
|
bool pause_reading_ = false;
|
|
254
281
|
std::deque<WChunks> chunks_;
|