Skip to content

Conversation

@lovelydinosaur
Copy link
Contributor

@lovelydinosaur lovelydinosaur commented May 20, 2020

  • Port in URL becomes optional.
  • Origin stays as Tuple[bytes, bytes, int], since we need a canonical form there.
  • proxy_origin becomes proxy_url for better consistency.

HTTPX would need to update the proxy_origin form it uses to proxy_url.

Copy link
Contributor

@yeraydiazdiaz yeraydiazdiaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a minor docstring note

def __init__(
self,
proxy_origin: Origin,
proxy_url: URL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG thanks! 😅

The docstring above needs to be updated.

Copy link
Contributor

@florimondmanca florimondmanca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! I initially tackled this separately only to realize this PR already existed. :-) This implementation with the url_to_origin() helper is even better than what I came up with.


def url_to_origin(url: URL) -> Origin:
scheme, host, explicit_port = url[:3]
default_port = {b'http': 80, b'https': 443}[scheme]
Copy link
Contributor

@florimondmanca florimondmanca May 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was curious why Black didn't cough up on this usage of single quotes, only to realize it's not run in scripts/check.

It's been a while since I've been around here but I assume it (and the isort check) was removed on purpose from there?

Edit: OK, looks like we're planning to introduce black and flake8 back in #67

@lovelydinosaur lovelydinosaur merged commit 875daba into master May 21, 2020
@lovelydinosaur lovelydinosaur deleted the optional-port branch May 21, 2020 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants