@encharm/cws 4.0.2 → 4.3.0
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/CHANGELOG.md +3 -0
- package/LICENSE +3 -2
- package/README.md +9 -2
- package/binding.gyp +2 -2
- package/dist/bindings/cws_darwin_arm64_node108.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node64.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node72.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node79.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node83.node +0 -0
- package/dist/bindings/cws_darwin_arm64_node93.node +0 -0
- package/dist/bindings/cws_darwin_x64_node108.node +0 -0
- package/dist/bindings/cws_darwin_x64_node64.node +0 -0
- package/dist/bindings/cws_darwin_x64_node72.node +0 -0
- package/dist/bindings/cws_darwin_x64_node79.node +0 -0
- package/dist/bindings/cws_darwin_x64_node83.node +0 -0
- package/dist/bindings/cws_darwin_x64_node93.node +0 -0
- package/dist/bindings/cws_linux_x64_node108.node +0 -0
- package/dist/bindings/cws_linux_x64_node64.node +0 -0
- package/dist/bindings/cws_linux_x64_node72.node +0 -0
- package/dist/bindings/cws_linux_x64_node79.node +0 -0
- package/dist/bindings/cws_linux_x64_node83.node +0 -0
- package/dist/bindings/cws_linux_x64_node93.node +0 -0
- package/dist/bindings/cws_win32_x64_node108.node +0 -0
- package/dist/bindings/cws_win32_x64_node64.node +0 -0
- package/dist/bindings/cws_win32_x64_node72.node +0 -0
- package/dist/bindings/cws_win32_x64_node79.node +0 -0
- package/dist/bindings/cws_win32_x64_node83.node +0 -0
- package/dist/bindings/cws_win32_x64_node93.node +0 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +4 -0
- package/dist/index.js +3 -2
- package/dist/server.js +1 -0
- package/dist/shared.js +2 -1
- package/package.json +1 -1
- package/src/Addon.cpp +1 -0
- package/src/Addon.h +35 -2
- package/src/HTTPSocket.cpp +1 -1
- package/src/LICENSE +4 -0
- package/src/Socket.h +12 -3
- package/src/headers/{13 → 18}/aliased_buffer.h +61 -9
- package/src/headers/18/aliased_struct-inl.h +54 -0
- package/src/headers/18/aliased_struct.h +63 -0
- package/src/headers/{12 → 18}/async_wrap-inl.h +0 -0
- package/src/headers/{12 → 18}/async_wrap.h +26 -2
- package/src/headers/{12/base64.h → 18/base64-inl.h} +78 -86
- package/src/headers/18/base64.h +69 -0
- package/src/headers/{12 → 18}/base_object-inl.h +46 -25
- package/src/headers/{12 → 18}/base_object.h +82 -17
- package/src/headers/{12 → 18}/callback_queue-inl.h +9 -9
- package/src/headers/{12 → 18}/callback_queue.h +13 -5
- package/src/headers/18/cares_wrap.h +523 -0
- package/src/headers/{12 → 18}/connect_wrap.h +0 -0
- package/src/headers/{12 → 18}/connection_wrap.h +0 -0
- package/src/headers/18/crypto/crypto_aes.h +89 -0
- package/src/headers/{13/node_crypto_bio.h → 18/crypto/crypto_bio.h} +3 -4
- package/src/headers/18/crypto/crypto_cipher.h +291 -0
- package/src/headers/{13/node_crypto_clienthello-inl.h → 18/crypto/crypto_clienthello-inl.h} +4 -5
- package/src/headers/{13/node_crypto_clienthello.h → 18/crypto/crypto_clienthello.h} +3 -4
- package/src/headers/{12/node_crypto_common.h → 18/crypto/crypto_common.h} +49 -36
- package/src/headers/18/crypto/crypto_context.h +147 -0
- package/src/headers/18/crypto/crypto_dh.h +156 -0
- package/src/headers/18/crypto/crypto_dsa.h +77 -0
- package/src/headers/18/crypto/crypto_ec.h +170 -0
- package/src/headers/{12/node_crypto_groups.h → 18/crypto/crypto_groups.h} +3 -3
- package/src/headers/18/crypto/crypto_hash.h +89 -0
- package/src/headers/18/crypto/crypto_hkdf.h +65 -0
- package/src/headers/18/crypto/crypto_hmac.h +94 -0
- package/src/headers/18/crypto/crypto_keygen.h +305 -0
- package/src/headers/18/crypto/crypto_keys.h +420 -0
- package/src/headers/18/crypto/crypto_pbkdf2.h +76 -0
- package/src/headers/18/crypto/crypto_random.h +130 -0
- package/src/headers/18/crypto/crypto_rsa.h +141 -0
- package/src/headers/18/crypto/crypto_scrypt.h +87 -0
- package/src/headers/18/crypto/crypto_sig.h +168 -0
- package/src/headers/18/crypto/crypto_spkac.h +21 -0
- package/src/headers/18/crypto/crypto_timing.h +20 -0
- package/src/headers/{12/tls_wrap.h → 18/crypto/crypto_tls.h} +137 -66
- package/src/headers/18/crypto/crypto_util.h +791 -0
- package/src/headers/18/crypto/crypto_x509.h +143 -0
- package/src/headers/{12 → 18}/debug_utils-inl.h +0 -0
- package/src/headers/{13 → 18}/debug_utils.h +7 -4
- package/src/headers/{12 → 18}/diagnosticfilename-inl.h +0 -0
- package/src/headers/{12 → 18}/env-inl.h +397 -304
- package/src/headers/{12 → 18}/env.h +397 -172
- package/src/headers/{12 → 18}/handle_wrap.h +7 -3
- package/src/headers/18/histogram-inl.h +107 -0
- package/src/headers/18/histogram.h +239 -0
- package/src/headers/{13 → 18}/inspector_agent.h +4 -7
- package/src/headers/{12 → 18}/inspector_io.h +0 -0
- package/src/headers/{13 → 18}/inspector_profiler.h +17 -5
- package/src/headers/{12 → 18}/inspector_socket.h +0 -0
- package/src/headers/{12 → 18}/inspector_socket_server.h +0 -0
- package/src/headers/18/js_native_api.h +571 -0
- package/src/headers/{13 → 18}/js_native_api_types.h +30 -7
- package/src/headers/{12 → 18}/js_native_api_v8.h +220 -83
- package/src/headers/{12 → 18}/js_native_api_v8_internals.h +6 -5
- package/src/headers/{12 → 18}/js_stream.h +0 -0
- package/src/headers/{12 → 18}/json_utils.h +0 -0
- package/src/headers/{13 → 18}/memory_tracker-inl.h +6 -5
- package/src/headers/{13 → 18}/memory_tracker.h +0 -7
- package/src/headers/{13 → 18}/module_wrap.h +24 -7
- package/src/headers/{13 → 18}/node.h +329 -68
- package/src/headers/18/node_api.h +288 -0
- package/src/headers/18/node_api_internals.h +38 -0
- package/src/headers/{12 → 18}/node_api_types.h +12 -9
- package/src/headers/{12 → 18}/node_binding.h +0 -0
- package/src/headers/18/node_blob.h +191 -0
- package/src/headers/18/node_bob-inl.h +37 -0
- package/src/headers/18/node_bob.h +111 -0
- package/src/headers/{13 → 18}/node_buffer.h +0 -0
- package/src/headers/{13 → 18}/node_constants.h +5 -1
- package/src/headers/{12 → 18}/node_context_data.h +5 -0
- package/src/headers/{12 → 18}/node_contextify.h +37 -2
- package/src/headers/{10/node_javascript.h → 18/node_crypto.h} +30 -14
- package/src/headers/{12 → 18}/node_dir.h +0 -0
- package/src/headers/{12 → 18}/node_dtrace.h +0 -0
- package/src/headers/{12 → 18}/node_errors.h +90 -24
- package/src/headers/18/node_external_reference.h +145 -0
- package/src/headers/{13 → 18}/node_file-inl.h +38 -21
- package/src/headers/{12 → 18}/node_file.h +74 -13
- package/src/headers/{13 → 18}/node_http2.h +365 -269
- package/src/headers/{12 → 18}/node_http2_state.h +40 -50
- package/src/headers/{13 → 18}/node_http_common-inl.h +25 -5
- package/src/headers/{13 → 18}/node_http_common.h +24 -20
- package/src/headers/{13 → 18}/node_i18n.h +2 -1
- package/src/headers/{12 → 18}/node_internals.h +39 -41
- package/src/headers/{12 → 18}/node_main_instance.h +15 -18
- package/src/headers/{12 → 18}/node_mem-inl.h +0 -0
- package/src/headers/{12 → 18}/node_mem.h +1 -1
- package/src/headers/{13 → 18}/node_messaging.h +170 -23
- package/src/headers/{12 → 18}/node_metadata.h +17 -4
- package/src/headers/{12 → 18}/node_mutex.h +77 -1
- package/src/headers/{12 → 18}/node_native_module.h +11 -1
- package/src/headers/{12 → 18}/node_native_module_env.h +14 -8
- package/src/headers/{12 → 18}/node_object_wrap.h +0 -0
- package/src/headers/{13 → 18}/node_options-inl.h +51 -21
- package/src/headers/{13 → 18}/node_options.h +46 -14
- package/src/headers/18/node_perf.h +168 -0
- package/src/headers/{12 → 18}/node_perf_common.h +16 -22
- package/src/headers/{12 → 18}/node_platform.h +21 -16
- package/src/headers/18/node_process-inl.h +26 -0
- package/src/headers/18/node_process.h +97 -0
- package/src/headers/{13 → 18}/node_report.h +2 -2
- package/src/headers/{13 → 18}/node_revert.h +10 -0
- package/src/headers/{12 → 18}/node_root_certs.h +439 -651
- package/src/headers/18/node_snapshot_builder.h +43 -0
- package/src/headers/18/node_snapshotable.h +130 -0
- package/src/headers/{12 → 18}/node_sockaddr-inl.h +100 -4
- package/src/headers/18/node_sockaddr.h +405 -0
- package/src/headers/{13 → 18}/node_stat_watcher.h +7 -1
- package/src/headers/{12 → 18}/node_union_bytes.h +0 -0
- package/src/headers/{13 → 18}/node_url.h +18 -1
- package/src/headers/18/node_v8.h +41 -0
- package/src/headers/{12 → 18}/node_v8_platform-inl.h +10 -0
- package/src/headers/{13 → 18}/node_version.h +7 -7
- package/src/headers/{12 → 18}/node_wasi.h +0 -0
- package/src/headers/18/node_wasm_web_api.h +55 -0
- package/src/headers/{13 → 18}/node_watchdog.h +0 -0
- package/src/headers/{10 → 18}/node_win32_etw_provider-inl.h +7 -6
- package/src/headers/{10 → 18}/node_win32_etw_provider.h +0 -0
- package/src/headers/{13 → 18}/node_worker.h +24 -17
- package/src/headers/{12 → 18}/pipe_wrap.h +2 -0
- package/src/headers/{12 → 18}/req_wrap-inl.h +0 -0
- package/src/headers/{13 → 18}/req_wrap.h +1 -1
- package/src/headers/{12 → 18}/spawn_sync.h +0 -0
- package/src/headers/{13 → 18}/stream_base-inl.h +58 -22
- package/src/headers/{13 → 18}/stream_base.h +29 -3
- package/src/headers/{13 → 18}/stream_pipe.h +8 -3
- package/src/headers/{12 → 18}/stream_wrap.h +4 -1
- package/src/headers/{13 → 18}/string_bytes.h +0 -7
- package/src/headers/{12 → 18}/string_decoder-inl.h +0 -0
- package/src/headers/{10 → 18}/string_decoder.h +0 -0
- package/src/headers/{13 → 18}/string_search.h +2 -2
- package/src/headers/{12 → 18}/tcp_wrap.h +4 -0
- package/src/headers/{12 → 18}/threadpoolwork-inl.h +0 -0
- package/src/headers/18/timer_wrap-inl.h +32 -0
- package/src/headers/18/timer_wrap.h +85 -0
- package/src/headers/{13 → 18}/tracing/agent.h +1 -1
- package/src/headers/{12 → 18}/tracing/node_trace_buffer.h +0 -0
- package/src/headers/{12 → 18}/tracing/node_trace_writer.h +0 -0
- package/src/headers/{13 → 18}/tracing/trace_event.h +23 -13
- package/src/headers/{12 → 18}/tracing/trace_event_common.h +0 -0
- package/src/headers/{12 → 18}/tracing/traced_value.h +0 -0
- package/src/headers/{13 → 18}/tty_wrap.h +2 -1
- package/src/headers/{13 → 18}/udp_wrap.h +5 -0
- package/src/headers/{13 → 18}/util-inl.h +69 -15
- package/src/headers/{13 → 18}/util.h +93 -31
- package/src/headers/18/v8-fast-api-calls.h +939 -0
- package/src/headers/{12 → 18}/v8abbr.h +2 -2
- package/dist/bindings/cws_darwin_64.node +0 -0
- package/dist/bindings/cws_darwin_72.node +0 -0
- package/dist/bindings/cws_darwin_79.node +0 -0
- package/dist/bindings/cws_darwin_83.node +0 -0
- package/dist/bindings/cws_darwin_93.node +0 -0
- package/dist/bindings/cws_linux_64.node +0 -0
- package/dist/bindings/cws_linux_72.node +0 -0
- package/dist/bindings/cws_linux_79.node +0 -0
- package/dist/bindings/cws_linux_83.node +0 -0
- package/dist/bindings/cws_linux_93.node +0 -0
- package/dist/bindings/cws_win32_64.node +0 -0
- package/dist/bindings/cws_win32_72.node +0 -0
- package/dist/bindings/cws_win32_79.node +0 -0
- package/dist/bindings/cws_win32_83.node +0 -0
- package/dist/bindings/cws_win32_93.node +0 -0
- package/src/headers/10/aliased_buffer.h +0 -241
- package/src/headers/10/async_wrap-inl.h +0 -106
- package/src/headers/10/async_wrap.h +0 -218
- package/src/headers/10/base64.h +0 -197
- package/src/headers/10/base_object-inl.h +0 -132
- package/src/headers/10/base_object.h +0 -115
- package/src/headers/10/connect_wrap.h +0 -28
- package/src/headers/10/connection_wrap.h +0 -30
- package/src/headers/10/debug_utils.h +0 -128
- package/src/headers/10/env-inl.h +0 -906
- package/src/headers/10/env.h +0 -1046
- package/src/headers/10/handle_wrap.h +0 -114
- package/src/headers/10/inspector_agent.h +0 -137
- package/src/headers/10/inspector_io.h +0 -97
- package/src/headers/10/inspector_socket.h +0 -59
- package/src/headers/10/inspector_socket_server.h +0 -104
- package/src/headers/10/js_stream.h +0 -57
- package/src/headers/10/memory_tracker-inl.h +0 -318
- package/src/headers/10/memory_tracker.h +0 -246
- package/src/headers/10/module_wrap.h +0 -100
- package/src/headers/10/node.h +0 -863
- package/src/headers/10/node_api.h +0 -752
- package/src/headers/10/node_api_types.h +0 -171
- package/src/headers/10/node_buffer.h +0 -90
- package/src/headers/10/node_code_cache.h +0 -17
- package/src/headers/10/node_constants.h +0 -74
- package/src/headers/10/node_context_data.h +0 -39
- package/src/headers/10/node_contextify.h +0 -141
- package/src/headers/10/node_counters.h +0 -59
- package/src/headers/10/node_crypto.h +0 -699
- package/src/headers/10/node_crypto_bio.h +0 -177
- package/src/headers/10/node_crypto_clienthello-inl.h +0 -92
- package/src/headers/10/node_crypto_clienthello.h +0 -131
- package/src/headers/10/node_crypto_groups.h +0 -416
- package/src/headers/10/node_dtrace.h +0 -84
- package/src/headers/10/node_errors.h +0 -118
- package/src/headers/10/node_file.h +0 -373
- package/src/headers/10/node_http2.h +0 -1304
- package/src/headers/10/node_http2_state.h +0 -158
- package/src/headers/10/node_i18n.h +0 -69
- package/src/headers/10/node_internals.h +0 -952
- package/src/headers/10/node_messaging.h +0 -219
- package/src/headers/10/node_mutex.h +0 -191
- package/src/headers/10/node_object_wrap.h +0 -130
- package/src/headers/10/node_options-inl.h +0 -444
- package/src/headers/10/node_options.h +0 -397
- package/src/headers/10/node_perf.h +0 -134
- package/src/headers/10/node_perf_common.h +0 -96
- package/src/headers/10/node_persistent.h +0 -30
- package/src/headers/10/node_platform.h +0 -170
- package/src/headers/10/node_revert.h +0 -75
- package/src/headers/10/node_root_certs.h +0 -3393
- package/src/headers/10/node_stat_watcher.h +0 -65
- package/src/headers/10/node_url.h +0 -193
- package/src/headers/10/node_version.h +0 -120
- package/src/headers/10/node_watchdog.h +0 -114
- package/src/headers/10/node_win32_perfctr_provider.h +0 -58
- package/src/headers/10/node_worker.h +0 -94
- package/src/headers/10/pipe_wrap.h +0 -76
- package/src/headers/10/req_wrap-inl.h +0 -166
- package/src/headers/10/req_wrap.h +0 -61
- package/src/headers/10/sharedarraybuffer_metadata.h +0 -67
- package/src/headers/10/spawn_sync.h +0 -240
- package/src/headers/10/stream_base-inl.h +0 -458
- package/src/headers/10/stream_base.h +0 -378
- package/src/headers/10/stream_pipe.h +0 -72
- package/src/headers/10/stream_wrap.h +0 -130
- package/src/headers/10/string_bytes.h +0 -126
- package/src/headers/10/string_decoder-inl.h +0 -38
- package/src/headers/10/string_search.h +0 -620
- package/src/headers/10/tcp_wrap.h +0 -99
- package/src/headers/10/tls_wrap.h +0 -195
- package/src/headers/10/tracing/agent.h +0 -178
- package/src/headers/10/tracing/node_trace_buffer.h +0 -83
- package/src/headers/10/tracing/node_trace_writer.h +0 -75
- package/src/headers/10/tracing/trace_event.h +0 -706
- package/src/headers/10/tracing/trace_event_common.h +0 -1102
- package/src/headers/10/tracing/traced_value.h +0 -68
- package/src/headers/10/tty_wrap.h +0 -63
- package/src/headers/10/udp_wrap.h +0 -102
- package/src/headers/10/util-inl.h +0 -459
- package/src/headers/10/util.h +0 -508
- package/src/headers/10/v8abbr.h +0 -121
- package/src/headers/12/aliased_buffer.h +0 -263
- package/src/headers/12/debug_utils.h +0 -181
- package/src/headers/12/histogram-inl.h +0 -83
- package/src/headers/12/histogram.h +0 -98
- package/src/headers/12/http_parser_adaptor.h +0 -24
- package/src/headers/12/inspector_agent.h +0 -147
- package/src/headers/12/inspector_profiler.h +0 -137
- package/src/headers/12/js_native_api.h +0 -541
- package/src/headers/12/js_native_api_types.h +0 -139
- package/src/headers/12/memory_tracker-inl.h +0 -339
- package/src/headers/12/memory_tracker.h +0 -283
- package/src/headers/12/module_wrap.h +0 -99
- package/src/headers/12/node.h +0 -887
- package/src/headers/12/node_api.h +0 -239
- package/src/headers/12/node_buffer.h +0 -92
- package/src/headers/12/node_constants.h +0 -80
- package/src/headers/12/node_crypto.h +0 -800
- package/src/headers/12/node_crypto_bio.h +0 -195
- package/src/headers/12/node_crypto_clienthello-inl.h +0 -91
- package/src/headers/12/node_crypto_clienthello.h +0 -132
- package/src/headers/12/node_file-inl.h +0 -289
- package/src/headers/12/node_http2.h +0 -1311
- package/src/headers/12/node_http_parser_impl.h +0 -994
- package/src/headers/12/node_i18n.h +0 -144
- package/src/headers/12/node_messaging.h +0 -227
- package/src/headers/12/node_options-inl.h +0 -447
- package/src/headers/12/node_options.h +0 -479
- package/src/headers/12/node_perf.h +0 -181
- package/src/headers/12/node_process.h +0 -41
- package/src/headers/12/node_report.h +0 -47
- package/src/headers/12/node_revert.h +0 -78
- package/src/headers/12/node_sockaddr.h +0 -123
- package/src/headers/12/node_stat_watcher.h +0 -66
- package/src/headers/12/node_url.h +0 -188
- package/src/headers/12/node_version.h +0 -98
- package/src/headers/12/node_watchdog.h +0 -152
- package/src/headers/12/node_win32_etw_provider-inl.h +0 -287
- package/src/headers/12/node_win32_etw_provider.h +0 -99
- package/src/headers/12/node_worker.h +0 -142
- package/src/headers/12/req_wrap.h +0 -77
- package/src/headers/12/sharedarraybuffer_metadata.h +0 -72
- package/src/headers/12/stream_base-inl.h +0 -323
- package/src/headers/12/stream_base.h +0 -431
- package/src/headers/12/stream_pipe.h +0 -72
- package/src/headers/12/string_bytes.h +0 -142
- package/src/headers/12/string_decoder.h +0 -50
- package/src/headers/12/string_search.h +0 -638
- package/src/headers/12/tracing/agent.h +0 -195
- package/src/headers/12/tracing/trace_event.h +0 -710
- package/src/headers/12/tty_wrap.h +0 -64
- package/src/headers/12/udp_wrap.h +0 -222
- package/src/headers/12/util-inl.h +0 -529
- package/src/headers/12/util.h +0 -765
- package/src/headers/13/async_wrap-inl.h +0 -94
- package/src/headers/13/async_wrap.h +0 -224
- package/src/headers/13/base64.h +0 -197
- package/src/headers/13/base_object-inl.h +0 -353
- package/src/headers/13/base_object.h +0 -229
- package/src/headers/13/connect_wrap.h +0 -26
- package/src/headers/13/connection_wrap.h +0 -30
- package/src/headers/13/debug_utils-inl.h +0 -223
- package/src/headers/13/diagnosticfilename-inl.h +0 -33
- package/src/headers/13/env-inl.h +0 -1293
- package/src/headers/13/env.h +0 -1469
- package/src/headers/13/handle_wrap.h +0 -117
- package/src/headers/13/histogram-inl.h +0 -83
- package/src/headers/13/histogram.h +0 -98
- package/src/headers/13/inspector_io.h +0 -78
- package/src/headers/13/inspector_socket.h +0 -60
- package/src/headers/13/inspector_socket_server.h +0 -110
- package/src/headers/13/js_native_api.h +0 -541
- package/src/headers/13/js_native_api_v8.h +0 -303
- package/src/headers/13/js_native_api_v8_internals.h +0 -38
- package/src/headers/13/js_stream.h +0 -52
- package/src/headers/13/json_utils.h +0 -160
- package/src/headers/13/node_api.h +0 -239
- package/src/headers/13/node_api_types.h +0 -44
- package/src/headers/13/node_binding.h +0 -99
- package/src/headers/13/node_context_data.h +0 -39
- package/src/headers/13/node_contextify.h +0 -161
- package/src/headers/13/node_crypto.h +0 -800
- package/src/headers/13/node_crypto_common.h +0 -138
- package/src/headers/13/node_crypto_groups.h +0 -415
- package/src/headers/13/node_dir.h +0 -52
- package/src/headers/13/node_dtrace.h +0 -86
- package/src/headers/13/node_errors.h +0 -210
- package/src/headers/13/node_file.h +0 -364
- package/src/headers/13/node_http2_state.h +0 -144
- package/src/headers/13/node_internals.h +0 -405
- package/src/headers/13/node_main_instance.h +0 -97
- package/src/headers/13/node_mem-inl.h +0 -112
- package/src/headers/13/node_mem.h +0 -41
- package/src/headers/13/node_metadata.h +0 -109
- package/src/headers/13/node_mutex.h +0 -247
- package/src/headers/13/node_native_module.h +0 -99
- package/src/headers/13/node_native_module_env.h +0 -65
- package/src/headers/13/node_object_wrap.h +0 -132
- package/src/headers/13/node_perf.h +0 -181
- package/src/headers/13/node_perf_common.h +0 -97
- package/src/headers/13/node_platform.h +0 -190
- package/src/headers/13/node_process.h +0 -41
- package/src/headers/13/node_root_certs.h +0 -3424
- package/src/headers/13/node_sockaddr-inl.h +0 -170
- package/src/headers/13/node_sockaddr.h +0 -123
- package/src/headers/13/node_union_bytes.h +0 -103
- package/src/headers/13/node_v8_platform-inl.h +0 -184
- package/src/headers/13/node_wasi.h +0 -108
- package/src/headers/13/node_win32_etw_provider-inl.h +0 -287
- package/src/headers/13/node_win32_etw_provider.h +0 -99
- package/src/headers/13/pipe_wrap.h +0 -78
- package/src/headers/13/req_wrap-inl.h +0 -170
- package/src/headers/13/spawn_sync.h +0 -242
- package/src/headers/13/stream_wrap.h +0 -130
- package/src/headers/13/string_decoder-inl.h +0 -37
- package/src/headers/13/string_decoder.h +0 -50
- package/src/headers/13/tcp_wrap.h +0 -101
- package/src/headers/13/threadpoolwork-inl.h +0 -57
- package/src/headers/13/tls_wrap.h +0 -221
- package/src/headers/13/tracing/node_trace_buffer.h +0 -83
- package/src/headers/13/tracing/node_trace_writer.h +0 -75
- package/src/headers/13/tracing/trace_event_common.h +0 -1109
- package/src/headers/13/tracing/traced_value.h +0 -70
- package/src/headers/13/v8abbr.h +0 -124
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
-
// copy of this software and associated documentation files (the
|
|
5
|
-
// "Software"), to deal in the Software without restriction, including
|
|
6
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
9
|
-
// following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included
|
|
12
|
-
// in all copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
19
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
20
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
-
|
|
22
|
-
#ifndef SRC_NODE_CRYPTO_BIO_H_
|
|
23
|
-
#define SRC_NODE_CRYPTO_BIO_H_
|
|
24
|
-
|
|
25
|
-
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
26
|
-
|
|
27
|
-
#include "node_crypto.h"
|
|
28
|
-
#include "openssl/bio.h"
|
|
29
|
-
#include "util.h"
|
|
30
|
-
#include "v8.h"
|
|
31
|
-
|
|
32
|
-
namespace node {
|
|
33
|
-
|
|
34
|
-
class Environment;
|
|
35
|
-
|
|
36
|
-
namespace crypto {
|
|
37
|
-
|
|
38
|
-
// This class represents buffers for OpenSSL I/O, implemented as a singly-linked
|
|
39
|
-
// list of chunks. It can be used either for writing data from Node to OpenSSL,
|
|
40
|
-
// or for reading data back, but not both.
|
|
41
|
-
// The structure is only accessed, and owned by, the OpenSSL BIOPointer
|
|
42
|
-
// (a.k.a. std::unique_ptr<BIO>).
|
|
43
|
-
class NodeBIO : public MemoryRetainer {
|
|
44
|
-
public:
|
|
45
|
-
~NodeBIO() override;
|
|
46
|
-
|
|
47
|
-
static BIOPointer New(Environment* env = nullptr);
|
|
48
|
-
|
|
49
|
-
// NewFixed takes a copy of `len` bytes from `data` and returns a BIO that,
|
|
50
|
-
// when read from, returns those bytes followed by EOF.
|
|
51
|
-
static BIOPointer NewFixed(const char* data, size_t len,
|
|
52
|
-
Environment* env = nullptr);
|
|
53
|
-
|
|
54
|
-
// Move read head to next buffer if needed
|
|
55
|
-
void TryMoveReadHead();
|
|
56
|
-
|
|
57
|
-
// Allocate new buffer for write if needed
|
|
58
|
-
void TryAllocateForWrite(size_t hint);
|
|
59
|
-
|
|
60
|
-
// Read `len` bytes maximum into `out`, return actual number of read bytes
|
|
61
|
-
size_t Read(char* out, size_t size);
|
|
62
|
-
|
|
63
|
-
// Memory optimization:
|
|
64
|
-
// Deallocate children of write head's child if they're empty
|
|
65
|
-
void FreeEmpty();
|
|
66
|
-
|
|
67
|
-
// Return pointer to internal data and amount of
|
|
68
|
-
// contiguous data available to read
|
|
69
|
-
char* Peek(size_t* size);
|
|
70
|
-
|
|
71
|
-
// Return pointers and sizes of multiple internal data chunks available for
|
|
72
|
-
// reading
|
|
73
|
-
size_t PeekMultiple(char** out, size_t* size, size_t* count);
|
|
74
|
-
|
|
75
|
-
// Find first appearance of `delim` in buffer or `limit` if `delim`
|
|
76
|
-
// wasn't found.
|
|
77
|
-
size_t IndexOf(char delim, size_t limit);
|
|
78
|
-
|
|
79
|
-
// Discard all available data
|
|
80
|
-
void Reset();
|
|
81
|
-
|
|
82
|
-
// Put `len` bytes from `data` into buffer
|
|
83
|
-
void Write(const char* data, size_t size);
|
|
84
|
-
|
|
85
|
-
// Return pointer to contiguous block of reserved data and the size available
|
|
86
|
-
// for future writes. Call Commit() once the write is complete.
|
|
87
|
-
char* PeekWritable(size_t* size);
|
|
88
|
-
|
|
89
|
-
// Specify how much data was written into the block returned by
|
|
90
|
-
// PeekWritable().
|
|
91
|
-
void Commit(size_t size);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// Return size of buffer in bytes
|
|
95
|
-
inline size_t Length() const {
|
|
96
|
-
return length_;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Provide a hint about the size of the next pending set of writes. TLS
|
|
100
|
-
// writes records of a maximum length of 16k of data plus a 5-byte header,
|
|
101
|
-
// a MAC (up to 20 bytes for SSLv3, TLS 1.0, TLS 1.1, and up to 32 bytes
|
|
102
|
-
// for TLS 1.2), and padding if a block cipher is used. If there is a
|
|
103
|
-
// large write this will result in potentially many buffers being
|
|
104
|
-
// allocated and gc'ed which can cause long pauses. By providing a
|
|
105
|
-
// guess about the amount of buffer space that will be needed in the
|
|
106
|
-
// next allocation this overhead is removed.
|
|
107
|
-
inline void set_allocate_tls_hint(size_t size) {
|
|
108
|
-
constexpr size_t kThreshold = 16 * 1024;
|
|
109
|
-
if (size >= kThreshold) {
|
|
110
|
-
allocate_hint_ = (size / kThreshold + 1) * (kThreshold + 5 + 32);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
inline void set_eof_return(int num) {
|
|
115
|
-
eof_return_ = num;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
inline int eof_return() {
|
|
119
|
-
return eof_return_;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
inline void set_initial(size_t initial) {
|
|
123
|
-
initial_ = initial;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
static NodeBIO* FromBIO(BIO* bio);
|
|
127
|
-
|
|
128
|
-
void MemoryInfo(MemoryTracker* tracker) const override {
|
|
129
|
-
tracker->TrackFieldWithSize("buffer", length_, "NodeBIO::Buffer");
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
SET_MEMORY_INFO_NAME(NodeBIO)
|
|
133
|
-
SET_SELF_SIZE(NodeBIO)
|
|
134
|
-
|
|
135
|
-
private:
|
|
136
|
-
static int New(BIO* bio);
|
|
137
|
-
static int Free(BIO* bio);
|
|
138
|
-
static int Read(BIO* bio, char* out, int len);
|
|
139
|
-
static int Write(BIO* bio, const char* data, int len);
|
|
140
|
-
static int Puts(BIO* bio, const char* str);
|
|
141
|
-
static int Gets(BIO* bio, char* out, int size);
|
|
142
|
-
static long Ctrl(BIO* bio, int cmd, long num, // NOLINT(runtime/int)
|
|
143
|
-
void* ptr);
|
|
144
|
-
|
|
145
|
-
static const BIO_METHOD* GetMethod();
|
|
146
|
-
|
|
147
|
-
// Enough to handle the most of the client hellos
|
|
148
|
-
static const size_t kInitialBufferLength = 1024;
|
|
149
|
-
static const size_t kThroughputBufferLength = 16384;
|
|
150
|
-
|
|
151
|
-
class Buffer {
|
|
152
|
-
public:
|
|
153
|
-
Buffer(Environment* env, size_t len) : env_(env),
|
|
154
|
-
read_pos_(0),
|
|
155
|
-
write_pos_(0),
|
|
156
|
-
len_(len),
|
|
157
|
-
next_(nullptr) {
|
|
158
|
-
data_ = new char[len];
|
|
159
|
-
if (env_ != nullptr)
|
|
160
|
-
env_->isolate()->AdjustAmountOfExternalAllocatedMemory(len);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
~Buffer() {
|
|
164
|
-
delete[] data_;
|
|
165
|
-
if (env_ != nullptr) {
|
|
166
|
-
const int64_t len = static_cast<int64_t>(len_);
|
|
167
|
-
env_->isolate()->AdjustAmountOfExternalAllocatedMemory(-len);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
Environment* env_;
|
|
172
|
-
size_t read_pos_;
|
|
173
|
-
size_t write_pos_;
|
|
174
|
-
size_t len_;
|
|
175
|
-
Buffer* next_;
|
|
176
|
-
char* data_;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
Environment* env_ = nullptr;
|
|
180
|
-
size_t initial_ = kInitialBufferLength;
|
|
181
|
-
size_t length_ = 0;
|
|
182
|
-
size_t allocate_hint_ = 0;
|
|
183
|
-
int eof_return_ = -1;
|
|
184
|
-
Buffer* read_head_ = nullptr;
|
|
185
|
-
Buffer* write_head_ = nullptr;
|
|
186
|
-
|
|
187
|
-
friend void node::crypto::InitCryptoOnce();
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
} // namespace crypto
|
|
191
|
-
} // namespace node
|
|
192
|
-
|
|
193
|
-
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
194
|
-
|
|
195
|
-
#endif // SRC_NODE_CRYPTO_BIO_H_
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
-
// copy of this software and associated documentation files (the
|
|
5
|
-
// "Software"), to deal in the Software without restriction, including
|
|
6
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
9
|
-
// following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included
|
|
12
|
-
// in all copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
19
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
20
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
-
|
|
22
|
-
#ifndef SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_
|
|
23
|
-
#define SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_
|
|
24
|
-
|
|
25
|
-
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
26
|
-
|
|
27
|
-
#include "node_crypto_clienthello.h"
|
|
28
|
-
#include "util.h"
|
|
29
|
-
|
|
30
|
-
namespace node {
|
|
31
|
-
namespace crypto {
|
|
32
|
-
|
|
33
|
-
inline ClientHelloParser::ClientHelloParser()
|
|
34
|
-
: state_(kEnded),
|
|
35
|
-
onhello_cb_(nullptr),
|
|
36
|
-
onend_cb_(nullptr),
|
|
37
|
-
cb_arg_(nullptr) {
|
|
38
|
-
Reset();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
inline void ClientHelloParser::Reset() {
|
|
42
|
-
frame_len_ = 0;
|
|
43
|
-
body_offset_ = 0;
|
|
44
|
-
extension_offset_ = 0;
|
|
45
|
-
session_size_ = 0;
|
|
46
|
-
session_id_ = nullptr;
|
|
47
|
-
tls_ticket_size_ = -1;
|
|
48
|
-
tls_ticket_ = nullptr;
|
|
49
|
-
servername_size_ = 0;
|
|
50
|
-
servername_ = nullptr;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
inline void ClientHelloParser::Start(ClientHelloParser::OnHelloCb onhello_cb,
|
|
54
|
-
ClientHelloParser::OnEndCb onend_cb,
|
|
55
|
-
void* onend_arg) {
|
|
56
|
-
if (!IsEnded())
|
|
57
|
-
return;
|
|
58
|
-
Reset();
|
|
59
|
-
|
|
60
|
-
CHECK_NOT_NULL(onhello_cb);
|
|
61
|
-
|
|
62
|
-
state_ = kWaiting;
|
|
63
|
-
onhello_cb_ = onhello_cb;
|
|
64
|
-
onend_cb_ = onend_cb;
|
|
65
|
-
cb_arg_ = onend_arg;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
inline void ClientHelloParser::End() {
|
|
69
|
-
if (state_ == kEnded)
|
|
70
|
-
return;
|
|
71
|
-
state_ = kEnded;
|
|
72
|
-
if (onend_cb_ != nullptr) {
|
|
73
|
-
onend_cb_(cb_arg_);
|
|
74
|
-
onend_cb_ = nullptr;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
inline bool ClientHelloParser::IsEnded() const {
|
|
79
|
-
return state_ == kEnded;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
inline bool ClientHelloParser::IsPaused() const {
|
|
83
|
-
return state_ == kPaused;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
} // namespace crypto
|
|
87
|
-
} // namespace node
|
|
88
|
-
|
|
89
|
-
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
90
|
-
|
|
91
|
-
#endif // SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
-
// copy of this software and associated documentation files (the
|
|
5
|
-
// "Software"), to deal in the Software without restriction, including
|
|
6
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
9
|
-
// following conditions:
|
|
10
|
-
//
|
|
11
|
-
// The above copyright notice and this permission notice shall be included
|
|
12
|
-
// in all copies or substantial portions of the Software.
|
|
13
|
-
//
|
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
19
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
20
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
-
|
|
22
|
-
#ifndef SRC_NODE_CRYPTO_CLIENTHELLO_H_
|
|
23
|
-
#define SRC_NODE_CRYPTO_CLIENTHELLO_H_
|
|
24
|
-
|
|
25
|
-
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
26
|
-
|
|
27
|
-
#include <cstddef> // size_t
|
|
28
|
-
#include <cstdint>
|
|
29
|
-
|
|
30
|
-
namespace node {
|
|
31
|
-
namespace crypto {
|
|
32
|
-
|
|
33
|
-
// Parse the client hello so we can do async session resumption. OpenSSL's
|
|
34
|
-
// session resumption uses synchronous callbacks, see SSL_CTX_sess_set_get_cb
|
|
35
|
-
// and get_session_cb.
|
|
36
|
-
//
|
|
37
|
-
// TLS1.3 handshakes masquerade as TLS1.2 session resumption, and to do this,
|
|
38
|
-
// they always include a session_id in the ClientHello, making up a bogus value
|
|
39
|
-
// if necessary. The parser can't know if its a bogus id, and will cause a
|
|
40
|
-
// 'newSession' event to be emitted. This should do no harm, the id won't be
|
|
41
|
-
// found, and the handshake will continue.
|
|
42
|
-
class ClientHelloParser {
|
|
43
|
-
public:
|
|
44
|
-
inline ClientHelloParser();
|
|
45
|
-
|
|
46
|
-
class ClientHello {
|
|
47
|
-
public:
|
|
48
|
-
inline uint8_t session_size() const { return session_size_; }
|
|
49
|
-
inline const uint8_t* session_id() const { return session_id_; }
|
|
50
|
-
inline bool has_ticket() const { return has_ticket_; }
|
|
51
|
-
inline uint8_t servername_size() const { return servername_size_; }
|
|
52
|
-
inline const uint8_t* servername() const { return servername_; }
|
|
53
|
-
|
|
54
|
-
private:
|
|
55
|
-
uint8_t session_size_;
|
|
56
|
-
const uint8_t* session_id_;
|
|
57
|
-
bool has_ticket_;
|
|
58
|
-
uint8_t servername_size_;
|
|
59
|
-
const uint8_t* servername_;
|
|
60
|
-
|
|
61
|
-
friend class ClientHelloParser;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
typedef void (*OnHelloCb)(void* arg, const ClientHello& hello);
|
|
65
|
-
typedef void (*OnEndCb)(void* arg);
|
|
66
|
-
|
|
67
|
-
void Parse(const uint8_t* data, size_t avail);
|
|
68
|
-
|
|
69
|
-
inline void Reset();
|
|
70
|
-
inline void Start(OnHelloCb onhello_cb, OnEndCb onend_cb, void* onend_arg);
|
|
71
|
-
inline void End();
|
|
72
|
-
inline bool IsPaused() const;
|
|
73
|
-
inline bool IsEnded() const;
|
|
74
|
-
|
|
75
|
-
private:
|
|
76
|
-
static const size_t kMaxTLSFrameLen = 16 * 1024 + 5;
|
|
77
|
-
static const size_t kMaxSSLExFrameLen = 32 * 1024;
|
|
78
|
-
static const uint8_t kServernameHostname = 0;
|
|
79
|
-
static const size_t kMinStatusRequestSize = 5;
|
|
80
|
-
|
|
81
|
-
enum ParseState {
|
|
82
|
-
kWaiting,
|
|
83
|
-
kTLSHeader,
|
|
84
|
-
kPaused,
|
|
85
|
-
kEnded
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
enum FrameType {
|
|
89
|
-
kChangeCipherSpec = 20,
|
|
90
|
-
kAlert = 21,
|
|
91
|
-
kHandshake = 22,
|
|
92
|
-
kApplicationData = 23,
|
|
93
|
-
kOther = 255
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
enum HandshakeType {
|
|
97
|
-
kClientHello = 1
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
enum ExtensionType {
|
|
101
|
-
kServerName = 0,
|
|
102
|
-
kTLSSessionTicket = 35
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
bool ParseRecordHeader(const uint8_t* data, size_t avail);
|
|
106
|
-
void ParseHeader(const uint8_t* data, size_t avail);
|
|
107
|
-
void ParseExtension(const uint16_t type,
|
|
108
|
-
const uint8_t* data,
|
|
109
|
-
size_t len);
|
|
110
|
-
bool ParseTLSClientHello(const uint8_t* data, size_t avail);
|
|
111
|
-
|
|
112
|
-
ParseState state_;
|
|
113
|
-
OnHelloCb onhello_cb_;
|
|
114
|
-
OnEndCb onend_cb_;
|
|
115
|
-
void* cb_arg_;
|
|
116
|
-
size_t frame_len_ = 0;
|
|
117
|
-
size_t body_offset_ = 0;
|
|
118
|
-
size_t extension_offset_ = 0;
|
|
119
|
-
uint8_t session_size_ = 0;
|
|
120
|
-
const uint8_t* session_id_ = nullptr;
|
|
121
|
-
uint16_t servername_size_ = 0;
|
|
122
|
-
const uint8_t* servername_ = nullptr;
|
|
123
|
-
uint16_t tls_ticket_size_ = -1;
|
|
124
|
-
const uint8_t* tls_ticket_ = nullptr;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
} // namespace crypto
|
|
128
|
-
} // namespace node
|
|
129
|
-
|
|
130
|
-
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
131
|
-
|
|
132
|
-
#endif // SRC_NODE_CRYPTO_CLIENTHELLO_H_
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
#ifndef SRC_NODE_FILE_INL_H_
|
|
2
|
-
#define SRC_NODE_FILE_INL_H_
|
|
3
|
-
|
|
4
|
-
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
5
|
-
|
|
6
|
-
#include "node_file.h"
|
|
7
|
-
#include "req_wrap-inl.h"
|
|
8
|
-
|
|
9
|
-
namespace node {
|
|
10
|
-
namespace fs {
|
|
11
|
-
|
|
12
|
-
FSContinuationData::FSContinuationData(uv_fs_t* req, int mode, uv_fs_cb done_cb)
|
|
13
|
-
: done_cb_(done_cb), req_(req), mode_(mode) {
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
void FSContinuationData::PushPath(std::string&& path) {
|
|
17
|
-
paths_.emplace_back(std::move(path));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
void FSContinuationData::PushPath(const std::string& path) {
|
|
21
|
-
paths_.push_back(path);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
void FSContinuationData::MaybeSetFirstPath(const std::string& path) {
|
|
25
|
-
if (first_path_.empty()) {
|
|
26
|
-
first_path_ = path;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
std::string FSContinuationData::PopPath() {
|
|
31
|
-
CHECK_GT(paths_.size(), 0);
|
|
32
|
-
std::string path = std::move(paths_.back());
|
|
33
|
-
paths_.pop_back();
|
|
34
|
-
return path;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
void FSContinuationData::Done(int result) {
|
|
38
|
-
req_->result = result;
|
|
39
|
-
done_cb_(req_);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
FSReqBase::FSReqBase(Environment* env,
|
|
43
|
-
v8::Local<v8::Object> req,
|
|
44
|
-
AsyncWrap::ProviderType type,
|
|
45
|
-
bool use_bigint)
|
|
46
|
-
: ReqWrap(env, req, type), use_bigint_(use_bigint) {
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
void FSReqBase::Init(const char* syscall,
|
|
50
|
-
const char* data,
|
|
51
|
-
size_t len,
|
|
52
|
-
enum encoding encoding) {
|
|
53
|
-
syscall_ = syscall;
|
|
54
|
-
encoding_ = encoding;
|
|
55
|
-
|
|
56
|
-
if (data != nullptr) {
|
|
57
|
-
CHECK(!has_data_);
|
|
58
|
-
buffer_.AllocateSufficientStorage(len + 1);
|
|
59
|
-
buffer_.SetLengthAndZeroTerminate(len);
|
|
60
|
-
memcpy(*buffer_, data, len);
|
|
61
|
-
has_data_ = true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
FSReqBase::FSReqBuffer&
|
|
66
|
-
FSReqBase::Init(const char* syscall, size_t len, enum encoding encoding) {
|
|
67
|
-
syscall_ = syscall;
|
|
68
|
-
encoding_ = encoding;
|
|
69
|
-
|
|
70
|
-
buffer_.AllocateSufficientStorage(len + 1);
|
|
71
|
-
has_data_ = false; // so that the data does not show up in error messages
|
|
72
|
-
return buffer_;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
FSReqCallback::FSReqCallback(Environment* env,
|
|
76
|
-
v8::Local<v8::Object> req, bool use_bigint)
|
|
77
|
-
: FSReqBase(env, req, AsyncWrap::PROVIDER_FSREQCALLBACK, use_bigint) {}
|
|
78
|
-
|
|
79
|
-
template <typename NativeT, typename V8T>
|
|
80
|
-
void FillStatsArray(AliasedBufferBase<NativeT, V8T>* fields,
|
|
81
|
-
const uv_stat_t* s,
|
|
82
|
-
const size_t offset) {
|
|
83
|
-
#define SET_FIELD_WITH_STAT(stat_offset, stat) \
|
|
84
|
-
fields->SetValue(offset + static_cast<size_t>(FsStatsOffset::stat_offset), \
|
|
85
|
-
static_cast<NativeT>(stat))
|
|
86
|
-
|
|
87
|
-
#define SET_FIELD_WITH_TIME_STAT(stat_offset, stat) \
|
|
88
|
-
/* NOLINTNEXTLINE(runtime/int) */ \
|
|
89
|
-
SET_FIELD_WITH_STAT(stat_offset, static_cast<unsigned long>(stat))
|
|
90
|
-
|
|
91
|
-
SET_FIELD_WITH_STAT(kDev, s->st_dev);
|
|
92
|
-
SET_FIELD_WITH_STAT(kMode, s->st_mode);
|
|
93
|
-
SET_FIELD_WITH_STAT(kNlink, s->st_nlink);
|
|
94
|
-
SET_FIELD_WITH_STAT(kUid, s->st_uid);
|
|
95
|
-
SET_FIELD_WITH_STAT(kGid, s->st_gid);
|
|
96
|
-
SET_FIELD_WITH_STAT(kRdev, s->st_rdev);
|
|
97
|
-
SET_FIELD_WITH_STAT(kBlkSize, s->st_blksize);
|
|
98
|
-
SET_FIELD_WITH_STAT(kIno, s->st_ino);
|
|
99
|
-
SET_FIELD_WITH_STAT(kSize, s->st_size);
|
|
100
|
-
SET_FIELD_WITH_STAT(kBlocks, s->st_blocks);
|
|
101
|
-
|
|
102
|
-
SET_FIELD_WITH_TIME_STAT(kATimeSec, s->st_atim.tv_sec);
|
|
103
|
-
SET_FIELD_WITH_TIME_STAT(kATimeNsec, s->st_atim.tv_nsec);
|
|
104
|
-
SET_FIELD_WITH_TIME_STAT(kMTimeSec, s->st_mtim.tv_sec);
|
|
105
|
-
SET_FIELD_WITH_TIME_STAT(kMTimeNsec, s->st_mtim.tv_nsec);
|
|
106
|
-
SET_FIELD_WITH_TIME_STAT(kCTimeSec, s->st_ctim.tv_sec);
|
|
107
|
-
SET_FIELD_WITH_TIME_STAT(kCTimeNsec, s->st_ctim.tv_nsec);
|
|
108
|
-
SET_FIELD_WITH_TIME_STAT(kBirthTimeSec, s->st_birthtim.tv_sec);
|
|
109
|
-
SET_FIELD_WITH_TIME_STAT(kBirthTimeNsec, s->st_birthtim.tv_nsec);
|
|
110
|
-
|
|
111
|
-
#undef SET_FIELD_WITH_TIME_STAT
|
|
112
|
-
#undef SET_FIELD_WITH_STAT
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
v8::Local<v8::Value> FillGlobalStatsArray(Environment* env,
|
|
116
|
-
const bool use_bigint,
|
|
117
|
-
const uv_stat_t* s,
|
|
118
|
-
const bool second) {
|
|
119
|
-
const ptrdiff_t offset =
|
|
120
|
-
second ? static_cast<ptrdiff_t>(FsStatsOffset::kFsStatsFieldsNumber) : 0;
|
|
121
|
-
if (use_bigint) {
|
|
122
|
-
auto* const arr = env->fs_stats_field_bigint_array();
|
|
123
|
-
FillStatsArray(arr, s, offset);
|
|
124
|
-
return arr->GetJSArray();
|
|
125
|
-
} else {
|
|
126
|
-
auto* const arr = env->fs_stats_field_array();
|
|
127
|
-
FillStatsArray(arr, s, offset);
|
|
128
|
-
return arr->GetJSArray();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
template <typename AliasedBufferT>
|
|
133
|
-
FSReqPromise<AliasedBufferT>*
|
|
134
|
-
FSReqPromise<AliasedBufferT>::New(Environment* env, bool use_bigint) {
|
|
135
|
-
v8::Local<v8::Object> obj;
|
|
136
|
-
if (!env->fsreqpromise_constructor_template()
|
|
137
|
-
->NewInstance(env->context())
|
|
138
|
-
.ToLocal(&obj)) {
|
|
139
|
-
return nullptr;
|
|
140
|
-
}
|
|
141
|
-
v8::Local<v8::Promise::Resolver> resolver;
|
|
142
|
-
if (!v8::Promise::Resolver::New(env->context()).ToLocal(&resolver) ||
|
|
143
|
-
obj->Set(env->context(), env->promise_string(), resolver).IsNothing()) {
|
|
144
|
-
return nullptr;
|
|
145
|
-
}
|
|
146
|
-
return new FSReqPromise(env, obj, use_bigint);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
template <typename AliasedBufferT>
|
|
150
|
-
FSReqPromise<AliasedBufferT>::~FSReqPromise() {
|
|
151
|
-
// Validate that the promise was explicitly resolved or rejected.
|
|
152
|
-
CHECK(finished_);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
template <typename AliasedBufferT>
|
|
156
|
-
FSReqPromise<AliasedBufferT>::FSReqPromise(
|
|
157
|
-
Environment* env,
|
|
158
|
-
v8::Local<v8::Object> obj,
|
|
159
|
-
bool use_bigint)
|
|
160
|
-
: FSReqBase(env, obj, AsyncWrap::PROVIDER_FSREQPROMISE, use_bigint),
|
|
161
|
-
stats_field_array_(
|
|
162
|
-
env->isolate(),
|
|
163
|
-
static_cast<size_t>(FsStatsOffset::kFsStatsFieldsNumber)) {}
|
|
164
|
-
|
|
165
|
-
template <typename AliasedBufferT>
|
|
166
|
-
void FSReqPromise<AliasedBufferT>::Reject(v8::Local<v8::Value> reject) {
|
|
167
|
-
finished_ = true;
|
|
168
|
-
v8::HandleScope scope(env()->isolate());
|
|
169
|
-
InternalCallbackScope callback_scope(this);
|
|
170
|
-
v8::Local<v8::Value> value =
|
|
171
|
-
object()->Get(env()->context(),
|
|
172
|
-
env()->promise_string()).ToLocalChecked();
|
|
173
|
-
v8::Local<v8::Promise::Resolver> resolver = value.As<v8::Promise::Resolver>();
|
|
174
|
-
USE(resolver->Reject(env()->context(), reject).FromJust());
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
template <typename AliasedBufferT>
|
|
178
|
-
void FSReqPromise<AliasedBufferT>::Resolve(v8::Local<v8::Value> value) {
|
|
179
|
-
finished_ = true;
|
|
180
|
-
v8::HandleScope scope(env()->isolate());
|
|
181
|
-
InternalCallbackScope callback_scope(this);
|
|
182
|
-
v8::Local<v8::Value> val =
|
|
183
|
-
object()->Get(env()->context(),
|
|
184
|
-
env()->promise_string()).ToLocalChecked();
|
|
185
|
-
v8::Local<v8::Promise::Resolver> resolver = val.As<v8::Promise::Resolver>();
|
|
186
|
-
USE(resolver->Resolve(env()->context(), value).FromJust());
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
template <typename AliasedBufferT>
|
|
190
|
-
void FSReqPromise<AliasedBufferT>::ResolveStat(const uv_stat_t* stat) {
|
|
191
|
-
FillStatsArray(&stats_field_array_, stat);
|
|
192
|
-
Resolve(stats_field_array_.GetJSArray());
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
template <typename AliasedBufferT>
|
|
196
|
-
void FSReqPromise<AliasedBufferT>::SetReturnValue(
|
|
197
|
-
const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|
198
|
-
v8::Local<v8::Value> val =
|
|
199
|
-
object()->Get(env()->context(),
|
|
200
|
-
env()->promise_string()).ToLocalChecked();
|
|
201
|
-
v8::Local<v8::Promise::Resolver> resolver = val.As<v8::Promise::Resolver>();
|
|
202
|
-
args.GetReturnValue().Set(resolver->GetPromise());
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
template <typename AliasedBufferT>
|
|
206
|
-
void FSReqPromise<AliasedBufferT>::MemoryInfo(MemoryTracker* tracker) const {
|
|
207
|
-
FSReqBase::MemoryInfo(tracker);
|
|
208
|
-
tracker->TrackField("stats_field_array", stats_field_array_);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
FSReqBase* GetReqWrap(Environment* env, v8::Local<v8::Value> value,
|
|
212
|
-
bool use_bigint) {
|
|
213
|
-
if (value->IsObject()) {
|
|
214
|
-
return Unwrap<FSReqBase>(value.As<v8::Object>());
|
|
215
|
-
} else if (value->StrictEquals(env->fs_use_promises_symbol())) {
|
|
216
|
-
if (use_bigint) {
|
|
217
|
-
return FSReqPromise<AliasedBigUint64Array>::New(env, use_bigint);
|
|
218
|
-
} else {
|
|
219
|
-
return FSReqPromise<AliasedFloat64Array>::New(env, use_bigint);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return nullptr;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Returns nullptr if the operation fails from the start.
|
|
226
|
-
template <typename Func, typename... Args>
|
|
227
|
-
FSReqBase* AsyncDestCall(Environment* env, FSReqBase* req_wrap,
|
|
228
|
-
const v8::FunctionCallbackInfo<v8::Value>& args,
|
|
229
|
-
const char* syscall, const char* dest,
|
|
230
|
-
size_t len, enum encoding enc, uv_fs_cb after,
|
|
231
|
-
Func fn, Args... fn_args) {
|
|
232
|
-
CHECK_NOT_NULL(req_wrap);
|
|
233
|
-
req_wrap->Init(syscall, dest, len, enc);
|
|
234
|
-
int err = req_wrap->Dispatch(fn, fn_args..., after);
|
|
235
|
-
if (err < 0) {
|
|
236
|
-
uv_fs_t* uv_req = req_wrap->req();
|
|
237
|
-
uv_req->result = err;
|
|
238
|
-
uv_req->path = nullptr;
|
|
239
|
-
after(uv_req); // after may delete req_wrap if there is an error
|
|
240
|
-
req_wrap = nullptr;
|
|
241
|
-
} else {
|
|
242
|
-
req_wrap->SetReturnValue(args);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
return req_wrap;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// Returns nullptr if the operation fails from the start.
|
|
249
|
-
template <typename Func, typename... Args>
|
|
250
|
-
FSReqBase* AsyncCall(Environment* env,
|
|
251
|
-
FSReqBase* req_wrap,
|
|
252
|
-
const v8::FunctionCallbackInfo<v8::Value>& args,
|
|
253
|
-
const char* syscall, enum encoding enc,
|
|
254
|
-
uv_fs_cb after, Func fn, Args... fn_args) {
|
|
255
|
-
return AsyncDestCall(env, req_wrap, args,
|
|
256
|
-
syscall, nullptr, 0, enc,
|
|
257
|
-
after, fn, fn_args...);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// Template counterpart of SYNC_CALL, except that it only puts
|
|
261
|
-
// the error number and the syscall in the context instead of
|
|
262
|
-
// creating an error in the C++ land.
|
|
263
|
-
// ctx must be checked using value->IsObject() before being passed.
|
|
264
|
-
template <typename Func, typename... Args>
|
|
265
|
-
int SyncCall(Environment* env, v8::Local<v8::Value> ctx,
|
|
266
|
-
FSReqWrapSync* req_wrap, const char* syscall,
|
|
267
|
-
Func fn, Args... args) {
|
|
268
|
-
env->PrintSyncTrace();
|
|
269
|
-
int err = fn(env->event_loop(), &(req_wrap->req), args..., nullptr);
|
|
270
|
-
if (err < 0) {
|
|
271
|
-
v8::Local<v8::Context> context = env->context();
|
|
272
|
-
v8::Local<v8::Object> ctx_obj = ctx.As<v8::Object>();
|
|
273
|
-
v8::Isolate* isolate = env->isolate();
|
|
274
|
-
ctx_obj->Set(context,
|
|
275
|
-
env->errno_string(),
|
|
276
|
-
v8::Integer::New(isolate, err)).Check();
|
|
277
|
-
ctx_obj->Set(context,
|
|
278
|
-
env->syscall_string(),
|
|
279
|
-
OneByteString(isolate, syscall)).Check();
|
|
280
|
-
}
|
|
281
|
-
return err;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
} // namespace fs
|
|
285
|
-
} // namespace node
|
|
286
|
-
|
|
287
|
-
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
288
|
-
|
|
289
|
-
#endif // SRC_NODE_FILE_INL_H_
|