Skip to content

Conversation

@haramj
Copy link
Member

@haramj haramj commented Sep 20, 2025

This PR resolves the // TODO(joyeecheung): support IPv6. comment in internal/http.js by adding comprehensive support for IPv6 address ranges to the NO_PROXY environment variable.

Previously, the ProxyConfig class's shouldUseProxy method could only handle IPv4 address ranges. With this change, users can now specify IPv6 ranges (e.g., ::1-::100) to correctly bypass proxies for hosts within those ranges.

The implementation involves:

  • A new helper function ipv6ToBigInt to convert 128-bit IPv6 addresses into BigInts for reliable numerical comparison.
  • Updated shouldUseProxy logic to check if a host is within a given IPv6 range.

This update ensures the proxy bypass feature is robust and consistent with both IPv4 and IPv6 network standards.

New test cases have been added to test/client-proxy/test-http-proxy-request-no-proxy-ipv6.mjs to verify the new functionality.

Test

  • A host within the specified IPv6 range (::1-::100) correctly bypasses the proxy.
  • A host outside the specified IPv6 range correctly uses the proxy.

This ensures that the new feature works as expected and does not introduce regressions to existing functionality.

/cc @joyeecheung

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run. labels Sep 20, 2025
@haramj haramj changed the title http: Add IPv6 range support for NO_PROXY environment variable http: add IPv6 range support for NO_PROXY environment variable Sep 20, 2025
@haramj haramj force-pushed the haramjeong-patch-250920 branch from 82b9bef to 397aac8 Compare September 20, 2025 19:00
@codecov
Copy link

codecov bot commented Sep 20, 2025

Codecov Report

❌ Patch coverage is 89.74359% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.44%. Comparing base (4612c79) to head (e8735e8).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/http.js 89.74% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59950      +/-   ##
==========================================
+ Coverage   88.25%   88.44%   +0.18%     
==========================================
  Files         703      703              
  Lines      207412   207436      +24     
  Branches    39893    39998     +105     
==========================================
+ Hits       183052   183459     +407     
+ Misses      16313    15947     -366     
+ Partials     8047     8030      -17     
Files with missing lines Coverage Δ
lib/internal/http.js 94.84% <89.74%> (-0.47%) ⬇️

... and 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants