Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(node-fetch): respect Node SSL-related env vars #1592

Merged
merged 4 commits into from
Aug 22, 2024

Conversation

ardatan
Copy link
Owner

@ardatan ardatan commented Aug 22, 2024

When cURL is used as the HTTP client implementation instead of node:http,
SSL_VERIFYPEER should be set false when the NODE_TLS_REJECT_UNAUTHORIZED environment variable is set to 0.
CAINFO should be set to the value of the NODE_EXTRA_CA_CERTS environment variable.

This allows the cURL client to use the same CA certificates and SSL configuration as node:http

Copy link
Contributor

github-actions bot commented Aug 22, 2024

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@whatwg-node/node-fetch 0.5.25-alpha-20240822095820-b39bfa0ecca2c39a9952bd1ffebf8ab8ef2f2772 npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Aug 22, 2024

@benchmarks/node-fetch results (noConsumeBody)

   ✓ active_handles.................: avg=140.18023 min=52      med=141     max=197      p(90)=159     p(95)=163    
     data_received..................: 23 MB  758 kB/s
     data_sent......................: 15 MB  491 kB/s
     http_req_blocked...............: avg=4.44µs    min=641ns   med=1.4µs   max=12.02ms  p(90)=2.01µs  p(95)=2.34µs 
     http_req_connecting............: avg=2.35µs    min=0s      med=0s      max=6.23ms   p(90)=0s      p(95)=0s     
     http_req_duration..............: avg=20.1ms    min=3.99ms  med=19.59ms max=847.77ms p(90)=25.29ms p(95)=27.54ms
       { expected_response:true }...: avg=20.1ms    min=3.99ms  med=19.59ms max=847.77ms p(90)=25.29ms p(95)=27.54ms
     http_req_failed................: 0.00%  ✓ 0           ✗ 148703
     http_req_receiving.............: avg=35.3µs    min=8.96µs  med=23.01µs max=23.73ms  p(90)=38.3µs  p(95)=45.56µs
     http_req_sending...............: avg=11.25µs   min=3.23µs  med=6.55µs  max=16.9ms   p(90)=9.71µs  p(95)=13.69µs
     http_req_tls_handshaking.......: avg=0s        min=0s      med=0s      max=0s       p(90)=0s      p(95)=0s     
     http_req_waiting...............: avg=20.05ms   min=3.96ms  med=19.56ms max=847.7ms  p(90)=25.25ms p(95)=27.45ms
     http_reqs......................: 148703 4956.184203/s
     iteration_duration.............: avg=40.31ms   min=12.58ms med=38.84ms max=874.78ms p(90)=45.39ms p(95)=50.02ms
     iterations.....................: 74333  2477.475507/s
     vus............................: 100    min=100       max=100 
     vus_max........................: 100    min=100       max=100 

Copy link
Contributor

github-actions bot commented Aug 22, 2024

@benchmarks/server results (undici)

     ✓ no-errors
     ✓ expected-result

   ✓ checks.........................: 100.00% ✓ 218722      ✗ 0     
     data_received..................: 22 MB   733 kB/s
     data_sent......................: 8.7 MB  292 kB/s
     http_req_blocked...............: avg=1.43µs   min=912ns    med=1.22µs   max=277.07µs p(90)=1.91µs   p(95)=2.07µs  
     http_req_connecting............: avg=1ns      min=0s       med=0s       max=131.01µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=213.18µs min=158.38µs med=199.41µs max=55.06ms  p(90)=226.49µs p(95)=236.93µs
       { expected_response:true }...: avg=213.18µs min=158.38µs med=199.41µs max=55.06ms  p(90)=226.49µs p(95)=236.93µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 109361
     http_req_receiving.............: avg=25.19µs  min=14.3µs   med=23.73µs  max=326.17µs p(90)=31.04µs  p(95)=33.2µs  
     http_req_sending...............: avg=6.28µs   min=4.08µs   med=5.53µs   max=345.97µs p(90)=8.15µs   p(95)=8.66µs  
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=181.7µs  min=133.63µs med=167.65µs max=54.99ms  p(90)=191.15µs p(95)=200.9µs 
     http_reqs......................: 109361  3645.223485/s
     iteration_duration.............: avg=269.95µs min=199.62µs med=255.46µs max=55.2ms   p(90)=286.27µs p(95)=299.52µs
     iterations.....................: 109361  3645.223485/s
     vus............................: 1       min=1         max=1   
     vus_max........................: 1       min=1         max=1   

Copy link
Contributor

github-actions bot commented Aug 22, 2024

@benchmarks/server results (ponyfill)

     ✓ no-errors
     ✓ expected-result

   ✓ checks.........................: 100.00% ✓ 295168      ✗ 0     
     data_received..................: 29 MB   969 kB/s
     data_sent......................: 12 MB   394 kB/s
     http_req_blocked...............: avg=1.39µs   min=921ns    med=1.2µs    max=280.36µs p(90)=1.88µs   p(95)=2.04µs  
     http_req_connecting............: avg=0ns      min=0s       med=0s       max=115.87µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=141.2µs  min=95.81µs  med=135.75µs max=7.5ms    p(90)=156.96µs p(95)=163.36µs
       { expected_response:true }...: avg=141.2µs  min=95.81µs  med=135.75µs max=7.5ms    p(90)=156.96µs p(95)=163.36µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 147584
     http_req_receiving.............: avg=24.55µs  min=12.44µs  med=23.42µs  max=1.37ms   p(90)=30.37µs  p(95)=32.44µs 
     http_req_sending...............: avg=6.29µs   min=4.15µs   med=5.59µs   max=281.22µs p(90)=8.07µs   p(95)=8.67µs  
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=110.35µs min=69.57µs  med=104.52µs max=7.33ms   p(90)=122.73µs p(95)=127.99µs
     http_reqs......................: 147584  4919.274298/s
     iteration_duration.............: avg=198.81µs min=141.51µs med=192.66µs max=7.81ms   p(90)=216.86µs p(95)=225.33µs
     iterations.....................: 147584  4919.274298/s
     vus............................: 1       min=1         max=1   
     vus_max........................: 1       min=1         max=1   

Copy link
Contributor

github-actions bot commented Aug 22, 2024

@benchmarks/server results (native)

     ✓ no-errors
     ✓ expected-result

   ✓ checks.........................: 100.00% ✓ 233494      ✗ 0     
     data_received..................: 24 MB   782 kB/s
     data_sent......................: 9.3 MB  311 kB/s
     http_req_blocked...............: avg=1.38µs   min=912ns    med=1.2µs    max=163.85µs p(90)=1.87µs   p(95)=2.02µs  
     http_req_connecting............: avg=0ns      min=0s       med=0s       max=114.3µs  p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=196.61µs min=151.73µs med=184.57µs max=15.86ms  p(90)=210.67µs p(95)=220.75µs
       { expected_response:true }...: avg=196.61µs min=151.73µs med=184.57µs max=15.86ms  p(90)=210.67µs p(95)=220.75µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 116747
     http_req_receiving.............: avg=24.83µs  min=12.55µs  med=23.37µs  max=4.69ms   p(90)=30.29µs  p(95)=32.43µs 
     http_req_sending...............: avg=6.17µs   min=4.14µs   med=5.38µs   max=349.63µs p(90)=8.06µs   p(95)=8.49µs  
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=165.6µs  min=123.08µs med=153.19µs max=15.8ms   p(90)=176.2µs  p(95)=185.55µs
     http_reqs......................: 116747  3891.441095/s
     iteration_duration.............: avg=252.66µs min=197.67µs med=239.83µs max=15.97ms  p(90)=269.4µs  p(95)=282.26µs
     iterations.....................: 116747  3891.441095/s
     vus............................: 1       min=1         max=1   
     vus_max........................: 1       min=1         max=1   

Copy link
Contributor

github-actions bot commented Aug 22, 2024

@benchmarks/node-fetch results (consumeBody)

   ✓ active_handles.................: avg=140.063706 min=52      med=141     max=195      p(90)=159     p(95)=163    
     data_received..................: 22 MB  722 kB/s
     data_sent......................: 14 MB  463 kB/s
     http_req_blocked...............: avg=3.61µs     min=631ns   med=1.34µs  max=7.06ms   p(90)=2.05µs  p(95)=2.41µs 
     http_req_connecting............: avg=1.41µs     min=0s      med=0s      max=4.98ms   p(90)=0s      p(95)=0s     
     http_req_duration..............: avg=21.1ms     min=3.9ms   med=20.58ms max=877.39ms p(90)=26.5ms  p(95)=28.26ms
       { expected_response:true }...: avg=21.1ms     min=3.9ms   med=20.58ms max=877.39ms p(90)=26.5ms  p(95)=28.26ms
     http_req_failed................: 0.00%  ✓ 0           ✗ 141684
     http_req_receiving.............: avg=35.51µs    min=9.5µs   med=24.81µs max=25.07ms  p(90)=39.12µs p(95)=46.5µs 
     http_req_sending...............: avg=11.34µs    min=3.42µs  med=6.56µs  max=17.09ms  p(90)=10.22µs p(95)=14.2µs 
     http_req_tls_handshaking.......: avg=0s         min=0s      med=0s      max=0s       p(90)=0s      p(95)=0s     
     http_req_waiting...............: avg=21.05ms    min=3.83ms  med=20.54ms max=877.33ms p(90)=26.46ms p(95)=28.18ms
     http_reqs......................: 141684 4721.392482/s
     iteration_duration.............: avg=42.32ms    min=15.59ms med=40.86ms max=904.93ms p(90)=47.16ms p(95)=51.9ms 
     iterations.....................: 70825  2360.129743/s
     vus............................: 100    min=100       max=100 
     vus_max........................: 100    min=100       max=100 

@ardatan ardatan merged commit 71c79c6 into master Aug 22, 2024
25 checks passed
@ardatan ardatan deleted the respect-node-env-vars branch August 22, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant