Skip to content

Multiple host headers #921

Closed
Closed

Description

@decatur

Checklist

  • [* ] The bug is reproducible against the latest release and/or master.
  • [* ] There are no similar issues or pull requests to fix it yet.

Describe the bug

As of version httpx 0.12.1, sync client send multiple host headers when proxied.

To reproduce

import httpx

proxies = {
    "http": "http://127.0.0.1:8080/"
}

with httpx.Client(proxies=proxies) as client:
    client.get('http://ec2-18-sdl-1.compute.amazonaws.com:8080/items')

Expected behavior

There must be only one host header, as some servers (for example uvicorn) will reject requests otherwise.

Actual behavior

Headers host and Host are set.

Debugging material

The second Host header is set in poolmanager._set_proxy_headers()

Environment

  • OS: Windows
  • Python version: 3.6.8
  • HTTPX version: 0.12.1
  • Async environment: No
  • HTTP proxy: yes
  • Custom certificates: No

Activity

  1. florimondmanca commented on May 2, 2020

    @florimondmanca
    Contributor

    Hi!

    Can you confirm if this is reproducible against the 0.13dev0 pre release issued yesterday?

    pip install httpx --pre
    

    0.13 switches to our own sync implementation instead of urllib3, which means this might be fixed now as we aligned the sync impl on the async one.

  2. yeraydiazdiaz commented on May 5, 2020

    @yeraydiazdiaz
    Contributor

    I can't reproduce this on 0.13.0.dev0 or master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    proxiesIssues related to HTTP and SOCKS proxies

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions