GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Z_DATA_ERROR when fetching a "Content-Encoding: gzip, deflate" response from the server · Issue #3762 · nodejs/undici

Z_DATA_ERROR when fetching a "Content-Encoding: gzip, deflate" response from the server #3762

New issue
Copy link
New issue
Copy link
Closed
Closed
Z_DATA_ERROR when fetching a "Content-Encoding: gzip, deflate" response from the server#3762
Copy link
Labels
bugSomething isn't working

Description

@kettanaito
kettanaito
opened on Oct 23, 2024
Issue body actions

Bug Description

fetch is terminated with a Z_DATA_ERROR when fetching a gzip, deflate compressed response from the server.

Reproducible By

Here's a 0 dependency reproduction:

  1. https://github.com/kettanaito/undici-gzip-deflate
  2. node ./index.js

Here's a copy-pastable reproduction:

import http from 'node:http'
import zlib from 'node:zlib'

const server = new http.Server((req, res) => {
  res.setHeader('content-encoding', 'gzip, deflate')
  res.end(zlib.deflateSync(zlib.gzipSync('hello world')))
})

server.listen(56789, async () => {
  const response = await fetch('http://localhost:56789/', {
    headers: { 'accept-encoding': 'gzip, deflate' },
  })
  const text = await response.text()
  console.assert(text === 'hello world')
})

Expected Behavior

  1. Fetch happens without errors.
  2. await response.text() returns a decompressed response string 'hello world'.

Logs & Screenshots

node:internal/deps/undici/undici:11190
            fetchParams.controller.controller.error(new TypeError("terminated", {
                                                    ^

TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:11190:53)
    at Fetch.emit (node:events:517:28)
    at Fetch.terminate (node:internal/deps/undici/undici:10375:14)
    at fetchParams.controller.resume (node:internal/deps/undici/undici:11167:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  [cause]: Error: incorrect header check
      at Zlib.zlibOnError [as onerror] (node:zlib:189:17) {
    errno: -3,
    code: 'Z_DATA_ERROR'
  }
}

Node.js v18.20.3

Environment

Reproducible on all versions of Node:

  • 18.20.3
  • 20.11.0
  • 22.3.0
  • 23.0.0
Reacted by Michael Solomon

Activity

  1. kettanaito
    added
    bugSomething isn't working
    on Oct 23, 2024
  2. Uzlopak commented on Oct 23, 2024

    @Uzlopak
    Uzlopak
    on Oct 23, 2024
    Contributor
    More actions

    isnt this alread fixed in #3632 ?

  3. kettanaito commented on Oct 23, 2024

    @kettanaito
    kettanaito
    on Oct 23, 2024
    ContributorAuthor
    More actions

    @Uzlopak, still reproducible on v23.0.0. Do you have an exact Node.js version where that fix has been merged?

    I can see that backporting to v6 failed. Can it be that the fix was never backported?

  4. Uzlopak commented on Oct 23, 2024

    @Uzlopak
    Uzlopak
    on Oct 23, 2024
    Contributor
    More actions

    I backported it manually. #3700

    Use undici 6.20.0 directly to test it.

  5. tsctx commented on Oct 23, 2024

    @tsctx
    tsctx
    on Oct 23, 2024
    Member
    More actions

    Sorry, I forgot to backport #3343 to 6.x, this should fix it.

    Reacted by Artem Zakharchenko
  6. tsctx commented on Oct 23, 2024

    @tsctx
    tsctx
    on Oct 23, 2024
    Member
    More actions

    Fixed by #3764

  7. tsctx
    closed this as completedon Oct 23, 2024
  8. gauthier-th
    added a commit that references this issue on Dec 3, 2024

    fix(setup): force fetch to use gzip for Emby auth

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.