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

Local address support #134

Merged
merged 24 commits into from
Aug 6, 2020
Merged

Local address support #134

merged 24 commits into from
Aug 6, 2020

Conversation

tomchristie
Copy link
Member

@tomchristie tomchristie commented Aug 5, 2020

Based on #100 with a few extra minor changes.

  • Use local_address as the keyword argument name. (If in doubt, follow the Trio API.)
  • Use str as the argument type. (Granted we're using bytes throughtout in our request() API, but I'm not sure I see the point in that here - all the underlying backends either expect or allow the address as a string. If in doubt, follow the Trio API.)
  • Support local_address=... on Trio. (currently only usable against trio master branch)
  • Pass with keyword-only argument usage internally to open_tcp_stream()

@tomchristie tomchristie added this to the 0.10.0 milestone Aug 5, 2020
@tomchristie tomchristie added the enhancement New feature or request label Aug 5, 2020
This was referenced Aug 5, 2020
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.

Looking great!

httpcore/_backends/sync.py Show resolved Hide resolved
httpcore/_backends/asyncio.py Outdated Show resolved Hide resolved
tests/async_tests/test_interfaces.py Outdated Show resolved Hide resolved
assert http_version == b"HTTP/1.1"
assert status_code == 200
assert reason == b"OK"
assert len(http._connections[url[:3]]) == 1 # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

It doesn't look like this test tests that the local_address actually gets used — I suppose that's intended for simplicity since testing that w/o mocking is not trivial?

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.

Approving in advance since my other comments are mostly nits, really.

@tomchristie
Copy link
Member Author

@florimondmanca Fantastic review points as always - thank you!

@tomchristie tomchristie merged commit 98633e0 into master Aug 6, 2020
@tomchristie tomchristie deleted the bwelling-master branch August 6, 2020 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants