Skip to content

Silent disconnect on very long request URLs #1368

@kamyuentse

Description

@kamyuentse

As iron/iron#563 mentioned, hyper close connection silently on very long request URLs.

The slice of the log shown bellow:

TRACE:hyper::proto::conn                        : Conn::read_head
TRACE:hyper::proto::h1::parse                   : Request.parse([Header; 100], [u8; 8192])
TRACE:hyper::proto::h1::parse                   : Request.parse([Header; 100], [u8; 16384])
TRACE:hyper::proto::h1::parse                   : Request.parse([Header; 100], [u8; 32768])
TRACE:hyper::proto::h1::parse                   : Request.parse([Header; 100], [u8; 65536])
TRACE:hyper::proto::h1::parse                   : Request.parse([Header; 100], [u8; 131072])
TRACE:hyper::proto::h1::parse                   : Request.parse([Header; 100], [u8; 262144])
TRACE:hyper::proto::h1::parse                   : Request.parse([Header; 100], [u8; 524288])
==> DEBUG:hyper::proto::io                          : MAX_BUFFER_SIZE reached, closing
==> TRACE:hyper::proto::conn                        : State::close_read()
==> DEBUG:hyper::proto::conn                        : parse error (Message head is too large) with 524288 bytes

I think hyper should define the MAX_URI_LENGTH, or make it configurable. When the length of a request's URI exceed that value, hyper send a response with 414 (Request URI too long) status code to client instead of closing the connection silently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-serverArea: server.C-bugCategory: bug. Something is wrong. This is bad!E-mediumEffort: medium. Some knowledge of how hyper internal works would be useful.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions