Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Conversation

@fredthomsen
Copy link
Contributor

Just making sure I am on the right track. Test cases are coming.

if not self.proxy_host:
host = self.host
else:
port = self.proxy_host
Copy link
Member

Choose a reason for hiding this comment

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

This is not quite right: you assign only host in the top block and only port in the bottom block. Need to do both in both. =)

@Lukasa
Copy link
Member

Lukasa commented Aug 31, 2015

Yup, this is definitely on the right track! I've left some notes inline, but I'm excited to see this work progress!

@fredthomsen
Copy link
Contributor Author

I am fixing this test case and adding one for http2, but before I go further do you agree with this test as it is structured?

@Lukasa
Copy link
Member

Lukasa commented Sep 17, 2015

I think the test is overcomplicated. I don't think we need to run something that amounts to an actual proxy: we just need to run something that knows it is pretending to be a proxy. What we really want to test is that, when we set up proxy values, we connect to the right place and then that we format the data correctly. This doesn't require a (fragile) socket proxy, just requires the "server" side of the connection to look for some slightly different stuff.

@fredthomsen
Copy link
Contributor Author

Replaced it with a simpler test case. Think everything should be ready now. Take a look.

else:
self.proxy_host, self.proxy_port = proxy_host, proxy_port
else:
self.proxy_host = None
Copy link
Member

Choose a reason for hiding this comment

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

Can we None out self.proxy_port here as well? I hate having attributes that only sometimes exist.

@Lukasa
Copy link
Member

Lukasa commented Sep 30, 2015

Alright @fredthomsen, this is looking really great! A few small comments inline, but we're basically there! Please also add yourself to the CONTRIBUTORS file. =)

@fredthomsen
Copy link
Contributor Author

Made these changes; however, looks like some strange build issues relating to DNS and SSL hit the CI process. Force a re-run?

@Lukasa
Copy link
Member

Lukasa commented Oct 5, 2015

Runs clean @fredthomsen! Let me do one last review.

if proxy_host:
if proxy_port is None:
try:
self.proxy_host, self.proxy_port = proxy_host.split(':')
Copy link
Member

Choose a reason for hiding this comment

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

This logic could go wrong with IPv6 addresses. I think we might need to pull this out into a helper function, because the logic is a bit tricky, but we can run on some basic heuristics: if the host ends with square bracket it doesn't contain a port. Otherwise, change the split into rsplit only allowing one split. That should work in more cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed this won't work with IPv6 addresses; however, the rest of the codebase or at least the http11 and http20 constructors have similar logic when just parsing the host and port. Should these all be updated as part of this effort and test cases added as well?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, if everything else is wrong too then I'd skip it for now. Let's open a GitHub issue to track it instead: see #170.

@Lukasa
Copy link
Member

Lukasa commented Oct 5, 2015

Sorry @fredthomsen, a few really small notes. Shout if any point you no longer want to keep polishing this and I can do the rest of it.

@fredthomsen
Copy link
Contributor Author

No worries. I am very particular as well. Don't mind doing it at all.

@Lukasa Lukasa mentioned this pull request Oct 11, 2015
@Lukasa
Copy link
Member

Lukasa commented Oct 11, 2015

Alright, beautiful, I'm happy with this. Thanks so much @fredthomsen!

Lukasa added a commit that referenced this pull request Oct 11, 2015
@Lukasa Lukasa merged commit 8c4a13b into python-hyper:development Oct 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants