Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous error message when decompressing brotli stream #13488

Closed
GreenYun opened this issue Apr 27, 2024 · 2 comments
Closed

Ambiguous error message when decompressing brotli stream #13488

GreenYun opened this issue Apr 27, 2024 · 2 comments

Comments

@GreenYun
Copy link

I did this

  1. compile curl with broti support
  2. run curl command line: curl --compressed -o example https://example.com
  3. got "curl: (23) Failed writing received data to disk/application" while the downloaded file is intact

I expected the following

The error message should be omitted if end of downloading stream encountered.

After digging into the code as well as the server response, I found:

  1. the server did not send Content-Length and curl may not know when the stream ends (current Nginx implementation will strip Content-Length because the stream length after compressed is not predictable)
  2. Botli support in curl returns CURLE_WRITE_ERROR when unexpectedly reaching end of stream, ref:
    return CURLE_WRITE_ERROR; /* Stream already ended. */

P.S. Zstd writer in curl will not return CURLE_WRITE_ERROR when Content-Length is not specified in response header.

curl/libcurl version

curl 8.7.1

operating system

macOS 12.7.4

@bagder
Copy link
Member

bagder commented Apr 27, 2024

I believe this is already fixed in master via b30d694.

@bagder
Copy link
Member

bagder commented Apr 27, 2024

First reported in #13209

@bagder bagder closed this as completed Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants