-
-
Notifications
You must be signed in to change notification settings - Fork 664
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Bug Description
Something node-fetch and browser could handle was the infamous raw deflate response from old servers
basically if the coding is either: coding === 'deflate' || coding === 'x-deflate'
then read the first byte. if it match chunk[0] & 0x0F) === 0x08
then use zlib.createInflate()
otherwise use zlib.createInflateRaw()
Reproducible By
You already have a test for it here:
undici/test/node-fetch/main.js
Lines 663 to 672 in 51fa0fe
xit('should decompress deflate raw response from old apache server', () => { | |
const url = `${base}deflate-raw` | |
return fetch(url).then(res => { | |
expect(res.headers.get('content-type')).to.equal('text/plain') | |
return res.text().then(result => { | |
expect(result).to.be.a('string') | |
expect(result).to.equal('hello world') | |
}) | |
}) | |
}) |
Expected Behavior
Additional context
Relevant part that needs fixing:
Lines 2018 to 2019 in 51fa0fe
} else if (coding === 'deflate') { | |
decoders.push(zlib.createInflate()) |
how node-fetch solved it:
https://github.com/node-fetch/node-fetch/blob/7b86e946b02dfdd28f4f8fca3d73a022cbb5ca1e/src/index.js#L314-L350
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers