Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port becomes optional #92

Merged
merged 4 commits into from
May 21, 2020
Merged

Port becomes optional #92

merged 4 commits into from
May 21, 2020

Conversation

tomchristie
Copy link
Member

@tomchristie tomchristie 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

@@ -51,7 +51,7 @@ class AsyncHTTPProxy(AsyncConnectionPool):

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
Member

@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
Member

@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

@tomchristie tomchristie merged commit 875daba into master May 21, 2020
@tomchristie tomchristie 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.

3 participants