fix: preserve DNS origin hostname on sockets#5577
Conversation
Signed-off-by: cyphercodes <cyphercodes@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5577 +/- ##
=======================================
Coverage 93.47% 93.48%
=======================================
Files 110 110
Lines 37564 37610 +46
=======================================
+ Hits 35114 35159 +45
- Misses 2450 2451 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: cyphercodes <cyphercodes@users.noreply.github.com>
|
Pushed a small test-only follow-up in 306602e to avoid relying on the Verification run locally:
|
|
Pushed a Windows-focused test follow-up in 67808e2. The HTTP DNS regression no longer asserts Verification run locally:
Note: a full local |
| if (!client[kHTTPContext]) { | ||
| if (client[kUrl].protocol === 'http:') { | ||
| client[kServerName] = request.servername | ||
| } |
|
Pushed a small follow-up in 4de0540 for the HTTPS review note. The client now stores Verification run locally:
|
| const family = net.isIP(hostname) | ||
| if (family !== 0 && servername && servername !== hostname) { | ||
| connectOptions.host = servername | ||
| connectOptions.lookup = (_hostname, lookupOptions, cb) => { |
There was a problem hiding this comment.
The _hostname here could use a comment. At first glance, the _hostname here and the address: hostname below look like a typo/mistake. A comment indicating that the _hostname is intentionally being ignored is helpful.
This relates to...
Fixes #5573
Rationale
The DNS interceptor connects to a selected IP address, which causes Node's
net.client.socketdiagnostics channel to expose the IP assocket._host. Consumers can no longer correlate TCP connection timing with the original request hostname.Changes
socket._hostandremoteAddressFeatures
N/A
Bug Fixes
Breaking Changes and Deprecations
N/A
Status
Testing:
node --test --test-name-pattern='#5573' test/interceptors/dns.jsnpm run test:interceptorsnpm run lintnpm run test:typescript