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

Handle PySocks ProxyConnectionError #202

Merged
merged 2 commits into from Oct 11, 2021
Merged

Conversation

ivanyu
Copy link
Contributor

@ivanyu ivanyu commented Sep 25, 2021

In the presence of PySocks, httplib2 falls back on it instead of its own bundled socks.py. However, exception ProxyConnectionError produced by PySocks is a bit different that expected, it lacks args. An attempt to extract errno from it fails with IndexError: tuple index out of range (see #170). The patch addresses this.

@ivanyu ivanyu force-pushed the PySocks-args branch 3 times, most recently from f0ca992 to 007089f Compare September 25, 2021 14:04
Copy link
Member

@temoto temoto left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

Please, extract it to function errno_from_exception or some better name, then I can add documenting comments.

@ivanyu ivanyu marked this pull request as ready for review October 3, 2021 11:35
@ivanyu
Copy link
Contributor Author

ivanyu commented Oct 3, 2021

Thank you @temoto, done.

Also, this should fix a failure in #192.

@ivanyu
Copy link
Contributor Author

ivanyu commented Oct 9, 2021

Is anything else needed to be done for this PR, @temoto?

ivanyu and others added 2 commits October 11, 2021 10:48
In the presence of PySocks, httplib2 falls back on it instead of its own bundled `socks.py`. However, exception `ProxyConnectionError` produced by PySocks is a bit different that expected, it lacks `args`. An attempt to extract `errno` from it fails with `IndexError: tuple index out of range` (see httplib2#170). The patch addresses this.
@temoto temoto merged commit dce3376 into httplib2:master Oct 11, 2021
@temoto
Copy link
Member

temoto commented Oct 11, 2021

@ivanyu sorry, I was trying to restore CI on Github Actions before doing any merges. It's in master now. Thank you for your work. Please emote rocket if you need this in pypi sooner.

@temoto temoto linked an issue Oct 11, 2021 that may be closed by this pull request
@temoto
Copy link
Member

temoto commented Nov 2, 2021

Released in httplib2>=0.20.2

kraj pushed a commit to YoeDistro/meta-openembedded that referenced this pull request Nov 10, 2021
0.20.2

  auth: support pyparsing v3 (AttributeError downcaseTokens)
  httplib2/httplib2#207

  proxy: correct extraction of errno from pysocks ProxyConnectionError
  httplib2/httplib2#202

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 Nov 10, 2021
0.20.2

  auth: support pyparsing v3 (AttributeError downcaseTokens)
  httplib2/httplib2#207

  proxy: correct extraction of errno from pysocks ProxyConnectionError
  httplib2/httplib2#202

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 Nov 10, 2021
0.20.2

  auth: support pyparsing v3 (AttributeError downcaseTokens)
  httplib2/httplib2#207

  proxy: correct extraction of errno from pysocks ProxyConnectionError
  httplib2/httplib2#202

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 Nov 10, 2021
0.20.2

  auth: support pyparsing v3 (AttributeError downcaseTokens)
  httplib2/httplib2#207

  proxy: correct extraction of errno from pysocks ProxyConnectionError
  httplib2/httplib2#202

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 Nov 10, 2021
0.20.2

  auth: support pyparsing v3 (AttributeError downcaseTokens)
  httplib2/httplib2#207

  proxy: correct extraction of errno from pysocks ProxyConnectionError
  httplib2/httplib2#202

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 Nov 11, 2021
0.20.2

  auth: support pyparsing v3 (AttributeError downcaseTokens)
  httplib2/httplib2#207

  proxy: correct extraction of errno from pysocks ProxyConnectionError
  httplib2/httplib2#202

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 Nov 11, 2021
0.20.2

  auth: support pyparsing v3 (AttributeError downcaseTokens)
  httplib2/httplib2#207

  proxy: correct extraction of errno from pysocks ProxyConnectionError
  httplib2/httplib2#202

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>
HerrMuellerluedenscheid pushed a commit to HerrMuellerluedenscheid/meta-openembedded that referenced this pull request Jan 16, 2022
0.20.2

  auth: support pyparsing v3 (AttributeError downcaseTokens)
  httplib2/httplib2#207

  proxy: correct extraction of errno from pysocks ProxyConnectionError
  httplib2/httplib2#202

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests fail with PySocks-1.7.1
2 participants