Skip to content

Weird header parsing in 1.9 #172

Closed
@Tpt

Description

@Tpt

Thank you so much for httparse all your other amazing libraries.

Sorry for the maybe bad bug report, I am not a HTTP expert.

With the new 1.9 version I get a test regression in oxhttp with strange parsing result. A : gets included in one of the header value.

Here is a test to reproduce the possible regression:

    #[test]
    fn test_http_parse() {
        let mut headers = [httparse::EMPTY_HEADER; 1024];
        let mut parsed_request = httparse::Request::new(&mut headers);
        parsed_request
            .parse(b"POST / HTTP/1.1\ncontent-length:4\n\n")
            .unwrap();
        for header in parsed_request.headers {
            if header.name == "content-length" {
                assert_eq!(header.value, b"4"); // Fails, we get ':4'
            }
        }
    }

Thank you again for your library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions