Skip to content

Request Header content-length in lower first case makes server ignore requests! #6

@GitMAGI

Description

@GitMAGI

The Content-Length Header in Requests must be UpperFirst-ed.
content-length will make the server parse an empty request body.
Content-Length in upper first, will work correctly.
The problem is that if you are using tools like Postman, the header regarding the length of the body, is automatically written by the tool (in my case Postman writes it in lower case).
I fixed it editing my local file httplib.h at line 511, in this way

auto len = get_header_value_int(x.headers, "Content-Length", 0);
if(!len)
    len = get_header_value_int(x.headers, "content-length", 0);

Metadata

Metadata

Assignees

No one assigned

    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