Skip to content

Customize maximum line length constraint #41

Description

@fdisperati-invoca

Hi there!

We have a server running on Falcon that uses a GET endpoint to handle large JSON payloads (due to some old integrations, switching to a POST endpoint isn't an option for now).

After updating to protocol-http1 v0.28.0 (via async-http v0.82.0), we started noticing that some requests were being dropped with the following error:

 4.34s     warn: Async::Task: Reading HTTP/1.1 requests for Async::HTTP::Protocol::HTTP1::Server. [oid=0x2580] [ec=0x2594] [pid=88108] [2025-01-15 22:35:13 -0800]
               | Task may have ended with unhandled exception.
               |   Protocol::HTTP1::LineLengthError: Line too long! (Protocol::HTTP1::LineLengthError)

We understand the security considerations behind this constraint, but we need to accept requests longer than 8192 bytes (at least up to 16kb).

For now, we’ve reverted to protocol-http1 v0.27.0 to remove the request size constraint, but it would be great if this constraint was customizable.

One possible solution could be introducing an environment variable, like PROTOCOL_HTTP1_MAXIMUM_LINE_LENGTH, to override the default:

DEFAULT_MAXIMUM_LINE_LENGTH = ENV.fetch('PROTOCOL_HTTP1_MAXIMUM_LINE_LENGTH', 8192)

I'd be happy to put together a PR if this sounds like a reasonable approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions