Skip to content

curl: (55) Failed sending HTTP request when trying to send a request with large header size. >8.1.2 #11405

Closed

Description

@dm-boiko

Hi, I am not certain this is a bug, perhaps this was mentioned somewhere, however, I did not discover it, looking at the changelog.
After updating curl from 8.0.1 I have started seeing requests failing to be sent. Further investigation showed, that this is only happening for requests with large header size (10K characters)

I did this

Send a request with large header size. Example:
curl -X GET -L -H "MyHeader: $(printf '%*s' 10000 | tr ' ' 'A')" https://postman-echo.com/get
This is working ok on 8.0.1, but not on 8.1.2.
8.1.2 is returning curl: (55) Failed sending HTTP request

I expected the following

Response from the server.

curl/libcurl version

Error happening with:

curl 8.1.2 (aarch64-alpine-linux-musl) libcurl/8.1.2 OpenSSL/1.1.1u zlib/1.2.12 brotli/1.0.9 nghttp2/1.47.0
Release-Date: 2023-05-30
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL threadsafe TLS-SRP UnixSockets

Request is sent successfully with:

curl 8.0.1 (aarch64-alpine-linux-musl) libcurl/8.0.1 OpenSSL/1.1.1u zlib/1.2.12 brotli/1.0.9 nghttp2/1.43.0
Release-Date: 2023-03-20
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL threadsafe TLS-SRP UnixSockets

operating system

Alpine Linux 3.16 Docker image.
Linux 5.15.49-linuxkit

Screenshot

image

Activity

  1. dfandrich commented on Jul 6, 2023

    @dfandrich
    Contributor
  2. icing commented on Jul 6, 2023

    @icing
    Contributor

    That seems likely. I assume you see different behaviour when adding --http1.1?

  3. dm-boiko commented on Jul 6, 2023

    @dm-boiko
    Author

    @icing yes, adding that is fixing the issue.
    As visible on the screenshot, nghttp2 is different in those versions. So it's only happening with HTTP2.

  4. icing commented on Jul 6, 2023

    @icing
    Contributor

    We introduced a limit when we refactored the http2 code. Most servers I know have a limit on header length to protect themselves from malicious input.

    Is this an experiment you are running or do you have a use case for such headers? If yes, what is the limit you are looking for?

  5. dm-boiko commented on Jul 6, 2023

    @dm-boiko
    Author

    I have discovered this, as libcurl is a downstream dependency of a library that I use in (ethon)
    It is a real life usecase, had to adjust what is being sent with the header. The limit I keep in mind always is one from aws alb - https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-limits.html
    That would be a little over 15k characters.
    I understand this might be quite the edge case, just wanted to bring this to attention, also in case somebody starts getting the error after updating from 8.0.1.

  6. dfandrich commented on Jul 6, 2023

    @dfandrich
    Contributor
  7. self-assigned this
    on Jul 7, 2023
  8. icing commented on Jul 7, 2023

    @icing
    Contributor

    Thanks. I made #11407 just now which overcomes these limitations.

    Curl internally has a general buffer limited to 1MB for assembling a HTTP request. This limit is now also in effect for HTTP/2 and HTTP/3 request processing with this PR.

  9. dm-boiko commented on Jul 9, 2023

    @dm-boiko
    Author

    Thank you!

  10. added a commit that references this issue on Jul 19, 2023
    0ad8ee2
  11. added a commit that references this issue on Sep 25, 2023
    ecdc2c3
  12. added a commit that references this issue on Mar 27, 2024
    4e88024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions