Skip to content

Introduce UnsupportedProtocol exception. #124

Closed

Description

@lovelydinosaur

To be raised for non http/https requests.

Note that this will allow use to drop enforce_http_url in httpx, and instead defer that handling entirely to the transport class.

Activity

  1. added this to the 0.10.0 milestone on Jul 31, 2020
  2. lovelydinosaur commented on Jul 31, 2020

    @lovelydinosaur
    MemberAuthor

    Thought: We also need to handle the no-host-in-URL case.

    Currently dealt with here: https://github.com/encode/httpx/blob/9409900898f40ed855e9c7a7664b7e068599a07d/httpx/_utils.py#L268-L282

    I guess we need both MissingHostname(...) and UnsupportedProtocol(...), then.

    We can drop httpx's InvalidURL after this, and instead mirror these two transport errors.

  3. lovelydinosaur commented on Aug 2, 2020

    @lovelydinosaur
    MemberAuthor

    Okay, so I don't think we want a MissingHostname exception class.
    Instead what we actually want for handling that case is to expand our ProtocolError, so...

    • ProtocolError
      • RemoteProtocolError
      • LocalProtocolError

    Everywhere we're currently raising it is a RemoteProtocolError, but we do actually want a small handful of LocalProtocolError cases, including...

    • Missing hostname in URL.
    • No Host header included. (Eg. that might expose in httpx if you create a invalid Request manually and .send() it.)

    Any similar cases.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions