genotrance / px

An HTTP proxy server to automatically authenticate through an NTLM proxy
MIT License
952 stars 98 forks source link

Split used to get port #128

Closed tobiasdroste closed 2 years ago

tobiasdroste commented 2 years ago

I figure rsplit should be used here instead of split to get the port. Otherwise we run into an issue with ipv6 addresses.

https://github.com/genotrance/px/blob/5bacc57b6dced5597588c46d60ebe84b2e612bcf/px.py#L1082

genotrance commented 2 years ago

I could push a fix for this but have no way to test in an IPv6 environment. There are surely more issues to get it working: e.g. #98. And also:

https://github.com/genotrance/px/blob/5bacc57b6dced5597588c46d60ebe84b2e612bcf/px.py#L1104

Will be glad to merge a PR that adds IPv6 support.

tobiasdroste commented 2 years ago

I just ran into an error for line 1084 (cause for this error was line 1082) and was able to fix it locally by using rsplit instead of split.

There may be other places that need to be adjusted but it would be a first step in the right direction to replace this split command by rsplit (it doesn't break ipv4 addresses as for those rsplit and split should always lead to the same result).

Since I fixed this locally I didn't run into the error again.

genotrance commented 2 years ago

Thanks for clarifying - I've made some fixes so hopefully this should work now.

tobiasdroste commented 2 years ago

Thanks for the fix! 😃