Skip to content

Host header overwritten in unsafe mode when using -target with raw requests #2296

@ayanrajpoot10

Description

@ayanrajpoot10

httpx version:

latest (dev branch)

Current Behavior:

When using -rr (raw request) together with -target in unsafe mode, httpx overwrites the Host header from the raw request file with the target host. This causes the original Host header specified in the request file to be ignored.

Expected Behavior:

The Host header from the raw request file should be preserved, even when -target and -unsafe are used.

Steps To Reproduce:

  1. Create a raw request file raw.txt:
GET / HTTP/1.1
Host: example.com
  1. Run httpx with:
httpx -rr raw.txt -target test.com -unsafe -debug
  1. Observe that the Host header is changed to test.com instead of staying as example.com.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions