Skip to content

Conversation

@rubnogueira
Copy link

fix: #61222

Using Chrome DevTools inspector tool, the response of the compressed requests is full of garbled symbols.

This PR implements proper compression decryption if the content-encoding header is returned in the response headers.

Repro here: https://github.com/rubnogueira/nodejs-repro-61222

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/inspector

@nodejs-github-bot nodejs-github-bot added http2 Issues or PRs related to the http2 subsystem. inspector Issues and PRs related to the V8 inspector protocol needs-ci PRs that need a full CI run. labels Dec 30, 2025
@rubnogueira
Copy link
Author

Tagging you @legendecas because I saw some of your work on the inspector.

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 97.53086% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.55%. Comparing base (ce2ec3d) to head (06183cd).
⚠️ Report is 42 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/inspector/network_http.js 96.96% 2 Missing ⚠️
lib/internal/inspector/network_http2.js 96.96% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #61226    +/-   ##
========================================
  Coverage   88.54%   88.55%            
========================================
  Files         704      704            
  Lines      208734   208865   +131     
  Branches    40271    40296    +25     
========================================
+ Hits       184823   184950   +127     
- Misses      15932    15948    +16     
+ Partials     7979     7967    -12     
Files with missing lines Coverage Δ
lib/internal/inspector/network.js 96.89% <100.00%> (+0.93%) ⬆️
lib/internal/inspector/network_http.js 95.43% <96.96%> (+0.16%) ⬆️
lib/internal/inspector/network_http2.js 88.99% <96.96%> (+1.25%) ⬆️

... and 27 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.

@rubnogueira rubnogueira changed the title fix: zipped responses inspector: fix compressed responses Dec 31, 2025
@rubnogueira
Copy link
Author

I just removed irrelevant code, improved testing/linting, built locally Node binary, and tested against my repro. Rebased first commit message following guidelines.

Please let me know if something is missing since it's my first contribution in this repo.

Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, LGTM

Comment on lines +167 to +213
async function testGzipHttp() {
await testCompressedResponse(httpServer, 'gzip', '/gzip');
}

async function testGzipHttps() {
await testCompressedResponse(httpsServer, 'gzip', '/gzip');
}

async function testXGzipHttp() {
await testCompressedResponse(httpServer, 'x-gzip', '/x-gzip');
}

async function testXGzipHttps() {
await testCompressedResponse(httpsServer, 'x-gzip', '/x-gzip');
}

async function testDeflateHttp() {
await testCompressedResponse(httpServer, 'deflate', '/deflate');
}

async function testDeflateHttps() {
await testCompressedResponse(httpsServer, 'deflate', '/deflate');
}

async function testBrotliHttp() {
await testCompressedResponse(httpServer, 'br', '/br');
}

async function testBrotliHttps() {
await testCompressedResponse(httpsServer, 'br', '/br');
}

async function testZstdHttp() {
await testCompressedResponse(httpServer, 'zstd', '/zstd');
}

async function testZstdHttps() {
await testCompressedResponse(httpsServer, 'zstd', '/zstd');
}

async function testPlainHttp() {
await testCompressedResponse(httpServer, null, '/plain');
}

async function testPlainHttps() {
await testCompressedResponse(httpsServer, null, '/plain');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it seems like these functions can be inlined as they are just one-liner.


async function testPlainHttp2Secure() {
await testCompressedResponse(http2SecureServer, null, '/plain');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto, these could be inlined.

@legendecas legendecas added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. http Issues or PRs related to the http subsystem. labels Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. http Issues or PRs related to the http subsystem. http2 Issues or PRs related to the http2 subsystem. inspector Issues and PRs related to the V8 inspector protocol needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--experimental-network-inspection not working properly with gzip, br, zstd and response

3 participants