Skip to content

Host Header Added Twice #110

@StefanB7

Description

@StefanB7

I was following the example in the project's readme (under esp-mbedtls heading):

... existing
let mut request = client
    .request(reqwless::request::Method::GET, "https://www.google.com")
    .await
    .unwrap()
    .content_type(reqwless::headers::ContentType::TextPlain)
    .headers(&[("Host", "google.com")])
    .send(&mut buffer)
    .await
    .unwrap();

However, I got a bunch of bad requests responses when trying to visit https://www.google.com as well as http://www.mobile-j.de.

Note I was setting the Host in the headers each time.

After debugging the request (by sending it to my localhost) I saw the host header was being added twice.

GET / HTTP/1.1
Host: 192.168.1.2
Content-Type: text/plain
Content-Length: 0
Host: api.telegram.org
user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:135.0) Gecko/20100101 Firefox/135.0
accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
accept-language: en-US,en;q=0.5

It looks like 192.168.1.2 was being added by reqwless by itself and the telegram host by explicit set of headers.

Thanks for the library!

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