Skip to content

Fix parsing http_proxy environment.#217

Merged
temoto merged 1 commit intohttplib2:masterfrom
kramarz:master
Feb 2, 2022
Merged

Fix parsing http_proxy environment.#217
temoto merged 1 commit intohttplib2:masterfrom
kramarz:master

Conversation

@kramarz
Copy link
Copy Markdown
Contributor

@kramarz kramarz commented Jan 31, 2022

Parsing proxy was breaking when proxy URL was set to ipv6 address. There
was also weird handling of proxy without a password. We should rely on
parsing those fields in urllib which is present in all supported
versions.

@temoto
Copy link
Copy Markdown
Member

temoto commented Feb 1, 2022

Thank you. It's nice and clean now. This is exactly what would merge #206.

Can get rid of single use variables now.

    url = urlparse.urlparse(url)

    proxy_type = 3  # socks.PROXY_TYPE_HTTP
    pi = ProxyInfo(
        proxy_type=proxy_type,
        proxy_host=url.hostname,
        proxy_port=url.port or dict(https=443, http=80)[method],
        proxy_user=url.username or None,
        proxy_pass=url.password or None,
        proxy_headers=None,
    )

If you agree, i can apply it myself.

@temoto
Copy link
Copy Markdown
Member

temoto commented Feb 1, 2022

flake8: tests/test_proxy.py:49:1: E302 expected 2 blank lines, found 1

Parsing proxy was breaking when proxy URL was set to ipv6 address. There
was also weird handling of proxy without a password. We should rely on
parsing those fields in urllib which is present in all supported
versions.
@kramarz
Copy link
Copy Markdown
Contributor Author

kramarz commented Feb 2, 2022

Thanks. I have amended these fixes.

@temoto temoto merged commit a22535f into httplib2:master Feb 2, 2022
@github-pages github-pages bot temporarily deployed to github-pages February 2, 2022 22:51 Inactive
@temoto temoto temporarily deployed to pypi-test February 2, 2022 22:51 Inactive
@temoto
Copy link
Copy Markdown
Member

temoto commented Feb 3, 2022

@kramarz thank you very much, released in 0.20.4

NickGoog added a commit to GoogleCloudPlatform/gsutil that referenced this pull request Feb 24, 2022
…0.20.4 (#1468)

* httplib2 was wrongly parsing `bar` in `bar@host` as password before v0.20.4

obviously wrong because there is no username before that password

fixed by: httplib2/httplib2#217
upstream issue: httplib2/httplib2#218

* Bumb httplib2 submodule version to latest and add new httplib2
dependency.

Was careful to choose a pyparsing version that supports Py3.5 and
httplib2 version requirements, by checking out the "pyparsing_2.4.x"
branch.

https://pypi.org/project/pyparsing/2.4.7/
https://github.com/httplib2/httplib2/blob/master/requirements.txt

Co-authored-by: NickGoog <hartunian@google.com>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this pull request Mar 7, 2022
Changelog:
=========
  proxy: support proxy urls with ipv6 address
  httplib2/httplib2#217

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this pull request Mar 7, 2022
Changelog:
=========
  proxy: support proxy urls with ipv6 address
  httplib2/httplib2#217

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this pull request Mar 7, 2022
Changelog:
=========
  proxy: support proxy urls with ipv6 address
  httplib2/httplib2#217

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this pull request Mar 8, 2022
Changelog:
=========
  proxy: support proxy urls with ipv6 address
  httplib2/httplib2#217

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this pull request Mar 8, 2022
Changelog:
=========
  proxy: support proxy urls with ipv6 address
  httplib2/httplib2#217

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this pull request Mar 9, 2022
Changelog:
=========
  proxy: support proxy urls with ipv6 address
  httplib2/httplib2#217

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
halstead pushed a commit to openembedded/meta-openembedded that referenced this pull request Mar 9, 2022
Changelog:
=========
  proxy: support proxy urls with ipv6 address
  httplib2/httplib2#217

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
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.

2 participants