visaljs 0.0.10 → 0.0.11
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/README.md +12 -4
- package/THIRD_PARTY_LICENSES +31 -1
- package/cli.js +962 -68
- package/node/include/js_node.h +11 -1
- package/node/prelude/_http_common.js +29 -0
- package/node/prelude/async_hooks.js +50 -11
- package/node/prelude/child_process.js +31 -4
- package/node/prelude/console.js +311 -143
- package/node/prelude/crypto.js +6 -4
- package/node/prelude/dgram.js +1169 -0
- package/node/prelude/diagnostics_channel.js +3 -1
- package/node/prelude/dns.js +250 -45
- package/node/prelude/dns_promises.js +8 -2
- package/node/prelude/fs_promises.js +9 -1
- package/node/prelude/http.js +395 -86
- package/node/prelude/https.js +13 -4
- package/node/prelude/internal/console_class.js +7 -0
- package/node/prelude/internal/console_global.js +25 -0
- package/node/prelude/internal/crypto/key_encryption.js +217 -0
- package/node/prelude/internal/crypto/keys.js +161 -26
- package/node/prelude/internal/crypto/random.js +24 -0
- package/node/prelude/internal/crypto/util.js +2 -1
- package/node/prelude/internal/crypto_x509.js +161 -0
- package/node/prelude/internal/dns_classes.js +6 -0
- package/node/prelude/internal/dns_resolver.js +371 -0
- package/node/prelude/internal/errors.js +9 -0
- package/node/prelude/internal/events_on.js +82 -37
- package/node/prelude/internal/features.js +8 -4
- package/node/prelude/internal/fs_filehandle.js +10 -4
- package/node/prelude/internal/perf_histogram.js +1 -1
- package/node/prelude/internal/process_more.js +32 -17
- package/node/prelude/internal/process_signals.js +8 -2
- package/node/prelude/internal/punycode.ts +163 -0
- package/node/prelude/internal/readline.js +648 -274
- package/node/prelude/internal/readline_editor.js +1240 -0
- package/node/prelude/internal/string_width.js +43 -0
- package/node/prelude/internal/tls/common.js +145 -33
- package/node/prelude/internal/tls/wrap.js +182 -49
- package/node/prelude/internal/tls/x509.js +4 -1
- package/node/prelude/internal/udp.js +177 -0
- package/node/prelude/net.js +13 -1
- package/node/prelude/os.js +24 -6
- package/node/prelude/perf_hooks.js +37 -2
- package/node/prelude/punycode.js +2 -130
- package/node/prelude/readline.js +113 -4
- package/node/prelude/readline_promises.js +56 -32
- package/node/prelude/tls.js +21 -4
- package/node/prelude/util.js +3 -16
- package/node/src/host_dns.c +623 -0
- package/node/src/host_http.c +12 -0
- package/node/src/host_net.c +46 -0
- package/node/src/host_os.c +1 -6
- package/node/src/host_sys.c +70 -0
- package/node/src/host_udp.c +418 -0
- package/node/third_party/c-ares/LICENSE.md +24 -0
- package/node/third_party/c-ares/config/darwin/ares_config.h +573 -0
- package/node/third_party/c-ares/config/freebsd/ares_config.h +573 -0
- package/node/third_party/c-ares/config/linux/ares_config.h +573 -0
- package/node/third_party/c-ares/config/openbsd/ares_config.h +583 -0
- package/node/third_party/c-ares/include/ares.h +1237 -0
- package/node/third_party/c-ares/include/ares_build.h +202 -0
- package/node/third_party/c-ares/include/ares_dns.h +127 -0
- package/node/third_party/c-ares/include/ares_dns_record.h +1119 -0
- package/node/third_party/c-ares/include/ares_nameser.h +510 -0
- package/node/third_party/c-ares/include/ares_version.h +47 -0
- package/node/third_party/c-ares/src/lib/ares_addrinfo2hostent.c +305 -0
- package/node/third_party/c-ares/src/lib/ares_addrinfo_localhost.c +245 -0
- package/node/third_party/c-ares/src/lib/ares_android.c +496 -0
- package/node/third_party/c-ares/src/lib/ares_android.h +38 -0
- package/node/third_party/c-ares/src/lib/ares_cancel.c +87 -0
- package/node/third_party/c-ares/src/lib/ares_close_sockets.c +137 -0
- package/node/third_party/c-ares/src/lib/ares_conn.c +511 -0
- package/node/third_party/c-ares/src/lib/ares_conn.h +202 -0
- package/node/third_party/c-ares/src/lib/ares_cookie.c +461 -0
- package/node/third_party/c-ares/src/lib/ares_data.c +168 -0
- package/node/third_party/c-ares/src/lib/ares_data.h +92 -0
- package/node/third_party/c-ares/src/lib/ares_destroy.c +159 -0
- package/node/third_party/c-ares/src/lib/ares_free_hostent.c +54 -0
- package/node/third_party/c-ares/src/lib/ares_free_string.c +33 -0
- package/node/third_party/c-ares/src/lib/ares_freeaddrinfo.c +67 -0
- package/node/third_party/c-ares/src/lib/ares_getaddrinfo.c +806 -0
- package/node/third_party/c-ares/src/lib/ares_getenv.c +38 -0
- package/node/third_party/c-ares/src/lib/ares_getenv.h +34 -0
- package/node/third_party/c-ares/src/lib/ares_gethostbyaddr.c +229 -0
- package/node/third_party/c-ares/src/lib/ares_gethostbyname.c +341 -0
- package/node/third_party/c-ares/src/lib/ares_getnameinfo.c +437 -0
- package/node/third_party/c-ares/src/lib/ares_hosts_file.c +960 -0
- package/node/third_party/c-ares/src/lib/ares_inet_net_pton.h +31 -0
- package/node/third_party/c-ares/src/lib/ares_init.c +631 -0
- package/node/third_party/c-ares/src/lib/ares_ipv6.h +115 -0
- package/node/third_party/c-ares/src/lib/ares_library_init.c +190 -0
- package/node/third_party/c-ares/src/lib/ares_metrics.c +261 -0
- package/node/third_party/c-ares/src/lib/ares_options.c +492 -0
- package/node/third_party/c-ares/src/lib/ares_parse_into_addrinfo.c +179 -0
- package/node/third_party/c-ares/src/lib/ares_private.h +648 -0
- package/node/third_party/c-ares/src/lib/ares_process.c +1649 -0
- package/node/third_party/c-ares/src/lib/ares_qcache.c +442 -0
- package/node/third_party/c-ares/src/lib/ares_query.c +151 -0
- package/node/third_party/c-ares/src/lib/ares_search.c +623 -0
- package/node/third_party/c-ares/src/lib/ares_send.c +300 -0
- package/node/third_party/c-ares/src/lib/ares_set_socket_functions.c +590 -0
- package/node/third_party/c-ares/src/lib/ares_setup.h +224 -0
- package/node/third_party/c-ares/src/lib/ares_socket.c +427 -0
- package/node/third_party/c-ares/src/lib/ares_socket.h +163 -0
- package/node/third_party/c-ares/src/lib/ares_sortaddrinfo.c +447 -0
- package/node/third_party/c-ares/src/lib/ares_strerror.c +91 -0
- package/node/third_party/c-ares/src/lib/ares_sysconfig.c +642 -0
- package/node/third_party/c-ares/src/lib/ares_sysconfig_files.c +851 -0
- package/node/third_party/c-ares/src/lib/ares_sysconfig_mac.c +373 -0
- package/node/third_party/c-ares/src/lib/ares_sysconfig_win.c +673 -0
- package/node/third_party/c-ares/src/lib/ares_timeout.c +162 -0
- package/node/third_party/c-ares/src/lib/ares_update_servers.c +1376 -0
- package/node/third_party/c-ares/src/lib/ares_version.c +36 -0
- package/node/third_party/c-ares/src/lib/config-dos.h +114 -0
- package/node/third_party/c-ares/src/lib/config-win32.h +396 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_array.c +409 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_htable.c +451 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_htable.h +174 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_htable_asvp.c +224 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_htable_dict.c +230 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_htable_strvp.c +210 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_htable_szvp.c +188 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_htable_vpstr.c +186 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_htable_vpvp.c +194 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_llist.c +385 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_slist.c +479 -0
- package/node/third_party/c-ares/src/lib/dsa/ares_slist.h +207 -0
- package/node/third_party/c-ares/src/lib/event/ares_event.h +191 -0
- package/node/third_party/c-ares/src/lib/event/ares_event_configchg.c +746 -0
- package/node/third_party/c-ares/src/lib/event/ares_event_epoll.c +192 -0
- package/node/third_party/c-ares/src/lib/event/ares_event_kqueue.c +248 -0
- package/node/third_party/c-ares/src/lib/event/ares_event_poll.c +140 -0
- package/node/third_party/c-ares/src/lib/event/ares_event_select.c +159 -0
- package/node/third_party/c-ares/src/lib/event/ares_event_thread.c +575 -0
- package/node/third_party/c-ares/src/lib/event/ares_event_wake_pipe.c +172 -0
- package/node/third_party/c-ares/src/lib/event/ares_event_win32.c +981 -0
- package/node/third_party/c-ares/src/lib/event/ares_event_win32.h +161 -0
- package/node/third_party/c-ares/src/lib/include/ares_array.h +276 -0
- package/node/third_party/c-ares/src/lib/include/ares_buf.h +732 -0
- package/node/third_party/c-ares/src/lib/include/ares_htable_asvp.h +130 -0
- package/node/third_party/c-ares/src/lib/include/ares_htable_dict.h +123 -0
- package/node/third_party/c-ares/src/lib/include/ares_htable_strvp.h +130 -0
- package/node/third_party/c-ares/src/lib/include/ares_htable_szvp.h +118 -0
- package/node/third_party/c-ares/src/lib/include/ares_htable_vpstr.h +111 -0
- package/node/third_party/c-ares/src/lib/include/ares_htable_vpvp.h +128 -0
- package/node/third_party/c-ares/src/lib/include/ares_llist.h +239 -0
- package/node/third_party/c-ares/src/lib/include/ares_mem.h +41 -0
- package/node/third_party/c-ares/src/lib/include/ares_str.h +261 -0
- package/node/third_party/c-ares/src/lib/inet_net_pton.c +451 -0
- package/node/third_party/c-ares/src/lib/inet_ntop.c +219 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_create_query.c +78 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_expand_name.c +99 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_expand_string.c +107 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_fds.c +80 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_getsock.c +85 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_parse_a_reply.c +107 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_parse_aaaa_reply.c +109 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_parse_caa_reply.c +137 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_parse_mx_reply.c +110 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_parse_naptr_reply.c +132 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_parse_ns_reply.c +154 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_parse_ptr_reply.c +213 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_parse_soa_reply.c +115 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_parse_srv_reply.c +114 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_parse_txt_reply.c +144 -0
- package/node/third_party/c-ares/src/lib/legacy/ares_parse_uri_reply.c +113 -0
- package/node/third_party/c-ares/src/lib/record/ares_dns_mapping.c +982 -0
- package/node/third_party/c-ares/src/lib/record/ares_dns_multistring.c +309 -0
- package/node/third_party/c-ares/src/lib/record/ares_dns_multistring.h +72 -0
- package/node/third_party/c-ares/src/lib/record/ares_dns_name.c +736 -0
- package/node/third_party/c-ares/src/lib/record/ares_dns_parse.c +1360 -0
- package/node/third_party/c-ares/src/lib/record/ares_dns_private.h +273 -0
- package/node/third_party/c-ares/src/lib/record/ares_dns_record.c +1701 -0
- package/node/third_party/c-ares/src/lib/record/ares_dns_write.c +1229 -0
- package/node/third_party/c-ares/src/lib/str/ares_buf.c +1510 -0
- package/node/third_party/c-ares/src/lib/str/ares_str.c +562 -0
- package/node/third_party/c-ares/src/lib/str/ares_strsplit.c +90 -0
- package/node/third_party/c-ares/src/lib/str/ares_strsplit.h +51 -0
- package/node/third_party/c-ares/src/lib/thirdparty/apple/dnsinfo.h +122 -0
- package/node/third_party/c-ares/src/lib/util/ares_iface_ips.c +640 -0
- package/node/third_party/c-ares/src/lib/util/ares_iface_ips.h +140 -0
- package/node/third_party/c-ares/src/lib/util/ares_math.c +167 -0
- package/node/third_party/c-ares/src/lib/util/ares_math.h +58 -0
- package/node/third_party/c-ares/src/lib/util/ares_rand.c +389 -0
- package/node/third_party/c-ares/src/lib/util/ares_rand.h +36 -0
- package/node/third_party/c-ares/src/lib/util/ares_threads.c +613 -0
- package/node/third_party/c-ares/src/lib/util/ares_threads.h +60 -0
- package/node/third_party/c-ares/src/lib/util/ares_time.h +49 -0
- package/node/third_party/c-ares/src/lib/util/ares_timeval.c +95 -0
- package/node/third_party/c-ares/src/lib/util/ares_uri.c +1627 -0
- package/node/third_party/c-ares/src/lib/util/ares_uri.h +252 -0
- package/node/third_party/c-ares/src/lib/windows_port.c +29 -0
- package/package.json +1 -1
- package/prebuilt/darwin-arm64/cares-a6286c65ca9374a3.a +0 -0
- package/prebuilt/darwin-x64/cares-a6286c65ca9374a3.a +0 -0
- package/prebuilt/linux-arm64/cares-4ba05ac8e948af8e.a +0 -0
- package/prebuilt/linux-arm64-musl/cares-4ba05ac8e948af8e.a +0 -0
- package/prebuilt/linux-x64/cares-4ba05ac8e948af8e.a +0 -0
- package/prebuilt/linux-x64-musl/cares-4ba05ac8e948af8e.a +0 -0
- package/prebuilt/win32-x64/boringssl-ce573858472b7fc9.a +0 -0
- package/prebuilt/win32-x64/brotli-20d86a61f30baeb3.a +0 -0
- package/prebuilt/win32-x64/cares-49c9ec95162b912d.a +0 -0
- package/prebuilt/win32-x64/uv-b11bae65d7fced82.a +0 -0
- package/prebuilt/win32-x64/zlib-4ce2317a4c3f5fb5.a +0 -0
- package/prebuilt/win32-x64/zstd-015315ac7c784c73.a +0 -0
- package/runtime/include/js_builtins.h +5 -0
- package/runtime/include/js_crypto.h +11 -0
- package/runtime/include/js_gc.h +13 -10
- package/runtime/include/js_jobs.h +2 -0
- package/runtime/include/js_object.h +58 -0
- package/runtime/include/jscontext.h +1 -0
- package/runtime/src/crypto_internal.h +1 -0
- package/runtime/src/crypto_subtle.c +66 -7
- package/runtime/src/crypto_tls.c +265 -19
- package/runtime/src/gc.c +73 -92
- package/runtime/src/inspect.c +18 -1
- package/runtime/src/jobs.c +37 -22
- package/runtime/src/object.c +49 -2
- package/runtime/src/os.c +16 -6
- package/runtime/src/os.h +2 -0
- package/runtime/src/process.c +97 -10
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/* MIT License
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) 2024 Brad House
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice (including the next
|
|
13
|
+
* paragraph) shall be included in all copies or substantial portions of the
|
|
14
|
+
* Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
* SPDX-License-Identifier: MIT
|
|
25
|
+
*/
|
|
26
|
+
#ifndef __ARES_URI_H
|
|
27
|
+
#define __ARES_URI_H
|
|
28
|
+
|
|
29
|
+
/*! \addtogroup ares_uri URI parser and writer implementation
|
|
30
|
+
*
|
|
31
|
+
* This is a fairly complete URI parser and writer implementation (RFC 3986) for
|
|
32
|
+
* schemes which use the :// syntax. Does not currently support URIs without an
|
|
33
|
+
* authority section, such as "mailto:person@example.com".
|
|
34
|
+
*
|
|
35
|
+
* Its implementation is overkill for our current needs to be able to express
|
|
36
|
+
* DNS server configuration, but there was really no reason not to support
|
|
37
|
+
* a greater subset of the specification.
|
|
38
|
+
*
|
|
39
|
+
* @{
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
struct ares_uri;
|
|
44
|
+
|
|
45
|
+
/*! URI object */
|
|
46
|
+
typedef struct ares_uri ares_uri_t;
|
|
47
|
+
|
|
48
|
+
/*! Create a new URI object
|
|
49
|
+
*
|
|
50
|
+
* \return new ares_uri_t, must be freed with ares_uri_destroy()
|
|
51
|
+
*/
|
|
52
|
+
ares_uri_t *ares_uri_create(void);
|
|
53
|
+
|
|
54
|
+
/*! Destroy an initialized URI object
|
|
55
|
+
*
|
|
56
|
+
* \param[in] uri Initialized URI object
|
|
57
|
+
*/
|
|
58
|
+
void ares_uri_destroy(ares_uri_t *uri);
|
|
59
|
+
|
|
60
|
+
/*! Set the URI scheme. Automatically lower-cases the scheme provided.
|
|
61
|
+
* Only allows Alpha, Digit, +, -, and . characters. Maximum length is
|
|
62
|
+
* 15 characters. This is required to be set to write a URI.
|
|
63
|
+
*
|
|
64
|
+
* \param[in] uri Initialized URI object
|
|
65
|
+
* \param[in] scheme Scheme to set the object to use
|
|
66
|
+
* \return ARES_SUCCESS on success
|
|
67
|
+
*/
|
|
68
|
+
ares_status_t ares_uri_set_scheme(ares_uri_t *uri, const char *scheme);
|
|
69
|
+
|
|
70
|
+
/*! Retrieve the currently configured URI scheme.
|
|
71
|
+
*
|
|
72
|
+
* \param[in] uri Initialized URI object
|
|
73
|
+
* \return string containing URI scheme
|
|
74
|
+
*/
|
|
75
|
+
const char *ares_uri_get_scheme(const ares_uri_t *uri);
|
|
76
|
+
|
|
77
|
+
/*! Set the username in the URI object
|
|
78
|
+
*
|
|
79
|
+
* \param[in] uri Initialized URI object
|
|
80
|
+
* \param[in] username Username to set. May be NULL to unset existing username.
|
|
81
|
+
* \return ARES_SUCCESS on success
|
|
82
|
+
*/
|
|
83
|
+
ares_status_t ares_uri_set_username(ares_uri_t *uri, const char *username);
|
|
84
|
+
|
|
85
|
+
/*! Retrieve the currently configured username.
|
|
86
|
+
*
|
|
87
|
+
* \param[in] uri Initialized URI object
|
|
88
|
+
* \return string containing username, maybe NULL if not set.
|
|
89
|
+
*/
|
|
90
|
+
const char *ares_uri_get_username(const ares_uri_t *uri);
|
|
91
|
+
|
|
92
|
+
/*! Set the password in the URI object
|
|
93
|
+
*
|
|
94
|
+
* \param[in] uri Initialized URI object
|
|
95
|
+
* \param[in] password Password to set. May be NULL to unset existing password.
|
|
96
|
+
* \return ARES_SUCCESS on success
|
|
97
|
+
*/
|
|
98
|
+
ares_status_t ares_uri_set_password(ares_uri_t *uri, const char *password);
|
|
99
|
+
|
|
100
|
+
/*! Retrieve the currently configured password.
|
|
101
|
+
*
|
|
102
|
+
* \param[in] uri Initialized URI object
|
|
103
|
+
* \return string containing password, maybe NULL if not set.
|
|
104
|
+
*/
|
|
105
|
+
const char *ares_uri_get_password(const ares_uri_t *uri);
|
|
106
|
+
|
|
107
|
+
/*! Set the host or ip address in the URI object. This is required to be
|
|
108
|
+
* set to write a URI. The character set is strictly validated.
|
|
109
|
+
*
|
|
110
|
+
* \param[in] uri Initialized URI object
|
|
111
|
+
* \param[in] host IPv4, IPv6, or hostname to set.
|
|
112
|
+
* \return ARES_SUCCESS on success
|
|
113
|
+
*/
|
|
114
|
+
ares_status_t ares_uri_set_host(ares_uri_t *uri, const char *host);
|
|
115
|
+
|
|
116
|
+
/*! Retrieve the currently configured host (or ip address). IPv6 addresses
|
|
117
|
+
* May include a link-local scope (e.g. fe80::b542:84df:1719:65e3%en0).
|
|
118
|
+
*
|
|
119
|
+
* \param[in] uri Initialized URI object
|
|
120
|
+
* \return string containing host, maybe NULL if not set.
|
|
121
|
+
*/
|
|
122
|
+
const char *ares_uri_get_host(const ares_uri_t *uri);
|
|
123
|
+
|
|
124
|
+
/*! Set the port to use in the URI object. A port value of 0 will omit
|
|
125
|
+
* the port from the URI when written, thus using the scheme's default.
|
|
126
|
+
*
|
|
127
|
+
* \param[in] uri Initialized URI object
|
|
128
|
+
* \param[in] port Port to set. Use 0 to unset.
|
|
129
|
+
* \return ARES_SUCCESS on success
|
|
130
|
+
*/
|
|
131
|
+
ares_status_t ares_uri_set_port(ares_uri_t *uri, unsigned short port);
|
|
132
|
+
|
|
133
|
+
/*! Retrieve the currently configured port
|
|
134
|
+
*
|
|
135
|
+
* \param[in] uri Initialized URI object
|
|
136
|
+
* \return port number, or 0 if not set.
|
|
137
|
+
*/
|
|
138
|
+
unsigned short ares_uri_get_port(const ares_uri_t *uri);
|
|
139
|
+
|
|
140
|
+
/*! Set the path in the URI object. Unsupported characters will be URI-encoded
|
|
141
|
+
* when written.
|
|
142
|
+
*
|
|
143
|
+
* \param[in] uri Initialized URI object
|
|
144
|
+
* \param[in] path Path to set. May be NULL to unset existing path.
|
|
145
|
+
* \return ARES_SUCCESS on success
|
|
146
|
+
*/
|
|
147
|
+
ares_status_t ares_uri_set_path(ares_uri_t *uri, const char *path);
|
|
148
|
+
|
|
149
|
+
/*! Retrieves the path in the URI object. If retrieved after parse, this
|
|
150
|
+
* value will be URI-decoded already.
|
|
151
|
+
*
|
|
152
|
+
* \param[in] uri Initialized URI object
|
|
153
|
+
* \return path string, or NULL if not set.
|
|
154
|
+
*/
|
|
155
|
+
const char *ares_uri_get_path(const ares_uri_t *uri);
|
|
156
|
+
|
|
157
|
+
/*! Set a new query key/value pair. There is no set order for query keys
|
|
158
|
+
* when output in the URI, they will be emitted in a random order. Keys are
|
|
159
|
+
* case-insensitive. Query keys and values will be automatically URI-encoded
|
|
160
|
+
* when written.
|
|
161
|
+
*
|
|
162
|
+
* \param[in] uri Initialized URI object
|
|
163
|
+
* \param[in] key Query key to use, must be non-zero length.
|
|
164
|
+
* \param[in] val Query value to use, may be NULL.
|
|
165
|
+
* \return ARES_SUCCESS on success
|
|
166
|
+
*/
|
|
167
|
+
ares_status_t ares_uri_set_query_key(ares_uri_t *uri, const char *key,
|
|
168
|
+
const char *val);
|
|
169
|
+
|
|
170
|
+
/*! Delete a specific query key.
|
|
171
|
+
*
|
|
172
|
+
* \param[in] uri Initialized URI object
|
|
173
|
+
* \param[in] key Key to delete.
|
|
174
|
+
* \return ARES_SUCCESS if deleted, ARES_ENOTFOUND if not found
|
|
175
|
+
*/
|
|
176
|
+
ares_status_t ares_uri_del_query_key(ares_uri_t *uri, const char *key);
|
|
177
|
+
|
|
178
|
+
/*! Retrieve the value associated with a query key. Keys are case-insensitive.
|
|
179
|
+
*
|
|
180
|
+
* \param[in] uri Initialized URI object
|
|
181
|
+
* \param[in] key Key to retrieve.
|
|
182
|
+
* \return string representing value, may be NULL if either not found or
|
|
183
|
+
* NULL value set. There is currently no way to indicate the
|
|
184
|
+
* difference.
|
|
185
|
+
*/
|
|
186
|
+
const char *ares_uri_get_query_key(const ares_uri_t *uri, const char *key);
|
|
187
|
+
|
|
188
|
+
/*! Retrieve a complete list of query keys.
|
|
189
|
+
*
|
|
190
|
+
* \param[in] uri Initialized URI object
|
|
191
|
+
* \param[out] num Number of keys.
|
|
192
|
+
* \return NULL on failure or no keys. Use
|
|
193
|
+
* ares_free_array(keys, num, ares_free) when done with array.
|
|
194
|
+
*/
|
|
195
|
+
char **ares_uri_get_query_keys(const ares_uri_t *uri, size_t *num);
|
|
196
|
+
|
|
197
|
+
/*! Set the fragment in the URI object. Unsupported characters will be
|
|
198
|
+
* URI-encoded when written.
|
|
199
|
+
*
|
|
200
|
+
* \param[in] uri Initialized URI object
|
|
201
|
+
* \param[in] fragment Fragment to set. May be NULL to unset existing fragment.
|
|
202
|
+
* \return ARES_SUCCESS on success
|
|
203
|
+
*/
|
|
204
|
+
ares_status_t ares_uri_set_fragment(ares_uri_t *uri, const char *fragment);
|
|
205
|
+
|
|
206
|
+
/*! Retrieves the fragment in the URI object. If retrieved after parse, this
|
|
207
|
+
* value will be URI-decoded already.
|
|
208
|
+
*
|
|
209
|
+
* \param[in] uri Initialized URI object
|
|
210
|
+
* \return fragment string, or NULL if not set.
|
|
211
|
+
*/
|
|
212
|
+
const char *ares_uri_get_fragment(const ares_uri_t *uri);
|
|
213
|
+
|
|
214
|
+
/*! Parse the provided URI buffer into a new URI object.
|
|
215
|
+
*
|
|
216
|
+
* \param[out] out Returned new URI object. free with ares_uri_destroy().
|
|
217
|
+
* \param[in] buf Buffer object containing the URI
|
|
218
|
+
* \return ARES_SUCCESS on successful parse. On failure the 'buf' object will
|
|
219
|
+
* be restored to its initial state in case another parser needs to
|
|
220
|
+
* be attempted.
|
|
221
|
+
*/
|
|
222
|
+
ares_status_t ares_uri_parse_buf(ares_uri_t **out, ares_buf_t *buf);
|
|
223
|
+
|
|
224
|
+
/*! Parse the provided URI string into a new URI object.
|
|
225
|
+
*
|
|
226
|
+
* \param[out] out Returned new URI object. free with ares_uri_destroy().
|
|
227
|
+
* \param[in] uri URI string to parse
|
|
228
|
+
* \return ARES_SUCCESS on successful parse
|
|
229
|
+
*/
|
|
230
|
+
ares_status_t ares_uri_parse(ares_uri_t **out, const char *uri);
|
|
231
|
+
|
|
232
|
+
/*! Write URI object to a new string buffer. Requires at least the scheme
|
|
233
|
+
* and host to be set for this to succeed.
|
|
234
|
+
*
|
|
235
|
+
* \param[out] out Returned new URI string. Free with ares_free().
|
|
236
|
+
* \param[in] uri Initialized URI object.
|
|
237
|
+
* \return ARES_SUCCESS on successful write.
|
|
238
|
+
*/
|
|
239
|
+
ares_status_t ares_uri_write(char **out, const ares_uri_t *uri);
|
|
240
|
+
|
|
241
|
+
/*! Write URI object to an existing ares_buf_t object. Requires at least the
|
|
242
|
+
* scheme and host to be set for this to succeed.
|
|
243
|
+
*
|
|
244
|
+
* \param[in] uri Initialized URI object.
|
|
245
|
+
* \param[in,out] buf Destination buf object.
|
|
246
|
+
* \return ARES_SUCCESS on successful write.
|
|
247
|
+
*/
|
|
248
|
+
ares_status_t ares_uri_write_buf(const ares_uri_t *uri, ares_buf_t *buf);
|
|
249
|
+
|
|
250
|
+
/*! @} */
|
|
251
|
+
|
|
252
|
+
#endif /* __ARES_URI_H */
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**********************************************************************
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) 1998 Massachusetts Institute of Technology
|
|
4
|
+
* Copyright (C) Daniel Stenberg
|
|
5
|
+
*
|
|
6
|
+
* SPDX-License-Identifier: MIT
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
#include "ares_private.h"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/* only do the following on windows
|
|
13
|
+
*/
|
|
14
|
+
#if defined(_WIN32) && !defined(MSDOS)
|
|
15
|
+
|
|
16
|
+
# ifdef __WATCOMC__
|
|
17
|
+
/*
|
|
18
|
+
* Watcom needs a DllMain() in order to initialise the clib startup code.
|
|
19
|
+
*/
|
|
20
|
+
BOOL WINAPI DllMain(HINSTANCE hnd, DWORD reason, LPVOID reserved)
|
|
21
|
+
{
|
|
22
|
+
(void)hnd;
|
|
23
|
+
(void)reason;
|
|
24
|
+
(void)reserved;
|
|
25
|
+
return (TRUE);
|
|
26
|
+
}
|
|
27
|
+
# endif
|
|
28
|
+
|
|
29
|
+
#endif /* WIN32 builds only */
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -265,6 +265,11 @@ static inline JSValue js_call_call(JSContext *ctx, JSValue m, JSValue f, uint32_
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
/* String.fromCharCode(c): a unit up to 0xFF is a static one-unit string. */
|
|
268
|
+
/* Static code's String.fromCharCode(c), trusted to be the built-in: c's unit (ToUint16). */
|
|
269
|
+
static inline JSValue js_from_char_code_unit(JSContext *ctx, uint16_t unit) {
|
|
270
|
+
return unit <= 0xFF ? js_char_string((uint8_t)unit) : js_new_string_utf16(ctx, &unit, 1);
|
|
271
|
+
}
|
|
272
|
+
|
|
268
273
|
static inline JSValue js_call_from_char_code(JSContext *ctx, JSValue f, JSValue this_val, JSValue c, const char *site) {
|
|
269
274
|
if (JS_LIKELY(js_is_function(f) && js_as_function(f)->entry == js_core_string_from_char_code && js_is_int32(c)
|
|
270
275
|
&& (uint32_t)js_as_int32(c) <= 0xFF))
|
|
@@ -64,6 +64,11 @@ JS_CRYPTO_PRIMITIVE(js_tls_context_add_roots)
|
|
|
64
64
|
JS_CRYPTO_PRIMITIVE(js_tls_context_add_ca)
|
|
65
65
|
JS_CRYPTO_PRIMITIVE(js_tls_context_set_cert)
|
|
66
66
|
JS_CRYPTO_PRIMITIVE(js_tls_context_set_key)
|
|
67
|
+
JS_CRYPTO_PRIMITIVE(js_tls_context_add_credential)
|
|
68
|
+
JS_CRYPTO_PRIMITIVE(js_tls_context_allow_partial_chain)
|
|
69
|
+
JS_CRYPTO_PRIMITIVE(js_tls_context_ticket_keys)
|
|
70
|
+
JS_CRYPTO_PRIMITIVE(js_tls_context_set_sessions)
|
|
71
|
+
JS_CRYPTO_PRIMITIVE(js_tls_pkcs12)
|
|
67
72
|
JS_CRYPTO_PRIMITIVE(js_tls_root_certificates)
|
|
68
73
|
JS_CRYPTO_PRIMITIVE(js_tls_new)
|
|
69
74
|
JS_CRYPTO_PRIMITIVE(js_tls_run)
|
|
@@ -72,10 +77,16 @@ JS_CRYPTO_PRIMITIVE(js_tls_info)
|
|
|
72
77
|
JS_CRYPTO_PRIMITIVE(js_tls_peer_certs)
|
|
73
78
|
JS_CRYPTO_PRIMITIVE(js_tls_verify_error)
|
|
74
79
|
JS_CRYPTO_PRIMITIVE(js_tls_session)
|
|
80
|
+
JS_CRYPTO_PRIMITIVE(js_tls_ticket)
|
|
75
81
|
JS_CRYPTO_PRIMITIVE(js_tls_export_keying_material)
|
|
76
82
|
JS_CRYPTO_PRIMITIVE(js_tls_set_no_renegotiation)
|
|
83
|
+
JS_CRYPTO_PRIMITIVE(js_tls_enable_keylog)
|
|
84
|
+
JS_CRYPTO_PRIMITIVE(js_tls_set_max_send_fragment)
|
|
77
85
|
JS_CRYPTO_PRIMITIVE(js_tls_finished)
|
|
78
86
|
JS_CRYPTO_PRIMITIVE(js_tls_ciphers)
|
|
87
|
+
JS_CRYPTO_PRIMITIVE(js_x509_check)
|
|
88
|
+
JS_CRYPTO_PRIMITIVE(js_x509_check_issued)
|
|
89
|
+
JS_CRYPTO_PRIMITIVE(js_x509_check_key)
|
|
79
90
|
#undef JS_CRYPTO_PRIMITIVE
|
|
80
91
|
|
|
81
92
|
#endif /* JS_CRYPTO_H */
|
package/runtime/include/js_gc.h
CHANGED
|
@@ -50,24 +50,27 @@ typedef struct JSBlock {
|
|
|
50
50
|
size_t map_size; /* JS_BLOCK_SIZE, or the large object's mapping */
|
|
51
51
|
uint32_t cell_size;
|
|
52
52
|
uint32_t cell_count;
|
|
53
|
-
uint8_t size_class;
|
|
53
|
+
uint8_t size_class; /* a small block's */
|
|
54
54
|
uint8_t is_large;
|
|
55
|
-
|
|
56
|
-
uint8_t queued; /* in its class's sweep queue */
|
|
57
|
-
uint8_t remembered; /* a large object: in the remembered set, with cards marked */
|
|
58
|
-
};
|
|
55
|
+
uint8_t queued; /* in its class's sweep queue */
|
|
59
56
|
uint8_t has_finalizable;
|
|
60
57
|
uint32_t index_magic; /* ceil(2^32 / cell_size): a cell's index is (offset * magic) >> 32 */
|
|
61
58
|
uint8_t young; /* the allocator took it since the last collection */
|
|
59
|
+
uint8_t remembered; /* a large object: in the remembered set, with cards marked */
|
|
60
|
+
uint8_t card_shift; /* a large object: a card is 2^card_shift bytes of it */
|
|
62
61
|
uint64_t mark_bits[JS_BITMAP_WORDS];
|
|
63
|
-
|
|
62
|
+
union {
|
|
63
|
+
uint64_t alloc_bits[JS_BITMAP_WORDS]; /* exact only while the world is stopped */
|
|
64
|
+
/* A large object's: its one cell's allocation bit, then its cards, a bit per card that a
|
|
65
|
+
* store gave a young cell since the last collection. */
|
|
66
|
+
struct {
|
|
67
|
+
uint64_t large_alloc;
|
|
68
|
+
uint64_t cards[JS_BITMAP_WORDS - 1];
|
|
69
|
+
};
|
|
70
|
+
};
|
|
64
71
|
} JSBlock;
|
|
65
72
|
|
|
66
|
-
/* A large object's cards: a bit per 2^card_shift bytes of the object
|
|
67
|
-
* that a store gave a young cell since the last collection. They live in the allocation bitmap,
|
|
68
|
-
* whose only other bit is bit 0 of word 0. A large object's size_class is its card_shift. */
|
|
69
73
|
#define JS_LARGE_CARDS ((JS_BITMAP_WORDS - 1) * 64)
|
|
70
|
-
static inline uint64_t *js_large_cards(JSBlock *b) { return &b->alloc_bits[1]; }
|
|
71
74
|
|
|
72
75
|
#define JS_BLOCK_FIRST_CELL \
|
|
73
76
|
((sizeof(JSBlock) + JS_CELL_ALIGN - 1) & ~(size_t)(JS_CELL_ALIGN - 1))
|
|
@@ -65,6 +65,8 @@ typedef enum JSRejectionMode {
|
|
|
65
65
|
} JSRejectionMode;
|
|
66
66
|
|
|
67
67
|
void js_enqueue_microtask(JSContext *ctx, const JSJob *job);
|
|
68
|
+
/* process.nextTick's queue, which a checkpoint runs before the microtasks (Node's order) */
|
|
69
|
+
void js_enqueue_tick(JSContext *ctx, const JSJob *job);
|
|
68
70
|
/* The checkpoint: runs every queued job (and the ones they queue), then processes
|
|
69
71
|
* unhandled rejections. A nested call does nothing. 0, or -1 after an uncaught error
|
|
70
72
|
* or a strict unhandled rejection (already reported). */
|
|
@@ -493,6 +493,64 @@ static inline JSValue js_get_length(JSContext *ctx, JSValue obj, JSValue key, JS
|
|
|
493
493
|
if (js_is_string(obj)) return js_int32((int32_t)js_string_length(obj)); /* below 2^30 */
|
|
494
494
|
return js_get_prop(ctx, obj, key, ic);
|
|
495
495
|
}
|
|
496
|
+
/* ---- Static code's arrays ("use static": number[], string[], boolean[]) ------------------ */
|
|
497
|
+
|
|
498
|
+
/* An element's kind (an i32[] is a number[] whose reads the code converts). tsc's element types
|
|
499
|
+
* aren't sound (a cast, an i32[] alias of a number[]), so every read checks it: a read's value is
|
|
500
|
+
* of the kind or the read throws. An index past the end is a RangeError, never undefined or a hole. */
|
|
501
|
+
enum { JS_SARRAY_NUMBER, JS_SARRAY_STRING, JS_SARRAY_BOOLEAN };
|
|
502
|
+
|
|
503
|
+
static inline bool js_sarray_is(JSValue v, int kind) {
|
|
504
|
+
switch (kind) {
|
|
505
|
+
case JS_SARRAY_NUMBER: return js_is_number(v);
|
|
506
|
+
case JS_SARRAY_STRING: return !js_is_empty(v) && js_is_string(v);
|
|
507
|
+
default: return js_is_bool(v);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
/* A Number key as an index: -1 (past every end) when it isn't one. */
|
|
511
|
+
static inline int64_t js_sarray_index_f64(double key) {
|
|
512
|
+
return key >= 0 && key < 4294967295.0 && (double)(int64_t)key == key ? (int64_t)key : -1;
|
|
513
|
+
}
|
|
514
|
+
static inline int64_t js_sarray_index(JSValue key) {
|
|
515
|
+
return js_is_int32(key) ? js_as_int32(key) : js_sarray_index_f64(js_as_number(key));
|
|
516
|
+
}
|
|
517
|
+
JS_WARN_UNUSED JSValue js_sarray_get_slow(JSContext *ctx, JSValue arr, int64_t i, int kind);
|
|
518
|
+
JS_WARN_UNUSED int js_sarray_set_slow(JSContext *ctx, JSValue arr, int64_t i, JSValue v, int kind);
|
|
519
|
+
JS_WARN_UNUSED JSValue js_sarray_length_slow(JSContext *ctx, JSValue arr);
|
|
520
|
+
JS_WARN_UNUSED JSValue js_sarray_push_slow(JSContext *ctx, JSValue arr, JSValue v, int kind);
|
|
521
|
+
|
|
522
|
+
static JS_FAST_PATH JSValue js_sarray_get(JSContext *ctx, JSValue arr, int64_t i, int kind) {
|
|
523
|
+
if (JS_LIKELY(js_is_array(arr))) {
|
|
524
|
+
JSElements *d = js_as_object(arr)->elements;
|
|
525
|
+
if (JS_LIKELY(d->kind == JS_ELEMENTS_DENSE && (uint64_t)i < d->length && js_sarray_is(d->data[i], kind))) return d->data[i];
|
|
526
|
+
}
|
|
527
|
+
return js_sarray_get_slow(ctx, arr, i, kind);
|
|
528
|
+
}
|
|
529
|
+
/* a[i] = v: at the length, a push; past it, a RangeError. */
|
|
530
|
+
static JS_FAST_PATH int js_sarray_set(JSContext *ctx, JSValue arr, int64_t i, JSValue v, int kind) {
|
|
531
|
+
if (JS_LIKELY(js_is_array(arr) && js_sarray_is(v, kind))) {
|
|
532
|
+
JSElements *d = js_as_object(arr)->elements;
|
|
533
|
+
if (JS_LIKELY(d->kind == JS_ELEMENTS_DENSE && (uint64_t)i < d->length && !js_is_empty(d->data[i]))) {
|
|
534
|
+
js_store(ctx, &d->cell, &d->data[i], v);
|
|
535
|
+
return 1;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return js_sarray_set_slow(ctx, arr, i, v, kind);
|
|
539
|
+
}
|
|
540
|
+
/* a.length, an int32 (a longer array is a RangeError). */
|
|
541
|
+
static JS_FAST_PATH JSValue js_sarray_length(JSContext *ctx, JSValue arr) {
|
|
542
|
+
if (JS_LIKELY(js_is_array(arr) && js_array_length(js_as_object(arr)) <= INT32_MAX)) return js_int32((int32_t)js_array_length(js_as_object(arr)));
|
|
543
|
+
return js_sarray_length_slow(ctx, arr);
|
|
544
|
+
}
|
|
545
|
+
/* a.push(v): the new length, an int32. */
|
|
546
|
+
static JS_FAST_PATH JSValue js_sarray_push(JSContext *ctx, JSValue arr, JSValue v, int kind) {
|
|
547
|
+
if (JS_LIKELY(js_is_array(arr) && js_sarray_is(v, kind) && js_array_length(js_as_object(arr)) < INT32_MAX)) {
|
|
548
|
+
if (JS_UNLIKELY(js_array_push(ctx, js_as_object(arr), v) < 0)) return JS_EXCEPTION;
|
|
549
|
+
return js_int32((int32_t)js_array_length(js_as_object(arr)));
|
|
550
|
+
}
|
|
551
|
+
return js_sarray_push_slow(ctx, arr, v, kind);
|
|
552
|
+
}
|
|
553
|
+
|
|
496
554
|
/* delete obj[key]: true or false (sloppy), a TypeError when strict and not deletable.
|
|
497
555
|
* `key` is a property key; js_delete_elem converts it first. */
|
|
498
556
|
JS_WARN_UNUSED JSValue js_delete_value(JSContext *ctx, JSValue obj, JSValue key, bool strict);
|
|
@@ -189,6 +189,7 @@ struct JSRuntime {
|
|
|
189
189
|
JSValue symbol_registry; /* Symbol.for's GlobalSymbolRegistry: key -> symbol (a root) */
|
|
190
190
|
uintptr_t stack_limit; /* lowest usable stack address, margin included */
|
|
191
191
|
JSJobQueue jobs; /* microtasks */
|
|
192
|
+
JSJobQueue ticks; /* process.nextTick's: each checkpoint runs them all before the microtasks (Node's) */
|
|
192
193
|
JSTimers timers; /* setTimeout / setInterval */
|
|
193
194
|
/* The async context: an opaque value the host keeps per chain of async work
|
|
194
195
|
* (node:async_hooks' AsyncLocalStorage keeps its stores in it). Every job, timer and promise
|
|
@@ -267,6 +267,7 @@ const char *js_ec_curve_jwk(int curve);
|
|
|
267
267
|
typedef enum JSWebAlg {
|
|
268
268
|
JS_WEB_HMAC = 1, JS_WEB_PBKDF2, JS_WEB_HKDF, JS_WEB_AES_CTR, JS_WEB_AES_CBC, JS_WEB_AES_GCM, JS_WEB_AES_KW,
|
|
269
269
|
JS_WEB_RSASSA, JS_WEB_RSA_PSS, JS_WEB_RSA_OAEP, JS_WEB_ECDSA, JS_WEB_ECDH, JS_WEB_X25519, JS_WEB_ED25519,
|
|
270
|
+
JS_WEB_CHACHA20_POLY1305,
|
|
270
271
|
} JSWebAlg;
|
|
271
272
|
|
|
272
273
|
/* KeyUsage, as bits in this order */
|