Skip to content

HTTP version string retains trailing CR (\r) #7

Description

@harmon25

Copilot review (PR #4, commit aae97d1, src/httpd.erl:461-467).

parse_heading/4 accumulates the version chars and on $\n tries to strip a leading \r, but the CR is trailing ("HTTP/1.1\r\n"):

Version = case RawVersion of
    [$\r | Clean] -> list_to_binary(Clean);   %% never matches
    _ -> list_to_binary(RawVersion)            %% keeps trailing \r
end,

Result: version is stored as <<"HTTP/1.1\r">> (verified on host OTP). This breaks any later version comparison/logging.

Fix: strip the trailing \r (e.g. string:trim/1 or drop the last char when it is $\r).

Validated against current code: still present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions