google-code-export / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
1 stars 0 forks source link

http proxy url containing properly formatted user-name and password not accepted #414

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. At the Bash prompt, set the http_proxy and https_proxy environment variables 
to properly formatted urls containing user-name and password credentials, for 
example:

$ export http_proxy=http://username:password@proxy.server.net:8080
$ export https_proxy=$http_proxy

2. Try to login. 
3. The script fails.

What is the expected output? What do you see instead?
I expected to be able to login successfully. Instead it fails with the 
following error Traceback: 

  File "/usr/bin/google", line 536, in <module>
    main()
  File "/usr/bin/google", line 530, in main
    run_once(options, args)
  File "/usr/bin/google", line 382, in run_once
    if client.RequestAccess(domain):
  File "/usr/lib/pymodules/python2.6/googlecl/service.py", line 301, in request_access
    extra_parameters=fetch_params)
  File "/usr/lib/pymodules/python2.6/gdata/service.py", line 403, in FetchOAuthRequestToken
    response = self.http_client.request('GET', str(request_token_url))
  File "/usr/lib/pymodules/python2.6/atom/http.py", line 93, in request
    connection = self._prepare_connection(url, all_headers)
  File "/usr/lib/pymodules/python2.6/atom/http.py", line 212, in _prepare_connection
    p_sock.connect((proxy_url.host, int(proxy_url.port)))
ValueError: invalid literal for int() with base 10: 'password@proxy.server.net'

What version of the product are you using?
1.2.4-0ubuntu2

Please provide any additional information below.

Original issue reported on code.google.com by christop...@gmail.com on 23 Jul 2010 at 5:39

GoogleCodeExporter commented 9 years ago
I have just un-installed  gdata-python 1.2.4-0ubuntu2 and installed 
gdata-python 2.0.10 to see if this fixed my problem. It does not. 

I now get the following Traceback:

  File "/usr/local/bin/google", line 536, in <module>
    main()
  File "/usr/local/bin/google", line 530, in main
    run_once(options, args)
  File "/usr/local/bin/google", line 382, in run_once
    if client.RequestAccess(domain):
  File "/usr/local/lib/python2.6/dist-packages/googlecl/service.py", line 301, in request_access
    extra_parameters=fetch_params)
  File "/usr/local/lib/python2.6/dist-packages/gdata/service.py", line 416, in FetchOAuthRequestToken
    response = self.http_client.request('GET', str(request_token_url))
  File "/usr/local/lib/python2.6/dist-packages/atom/http.py", line 132, in request
    connection = self._prepare_connection(url, all_headers)
  File "/usr/local/lib/python2.6/dist-packages/atom/http.py", line 240, in _prepare_connection
    p_sock.connect((proxy_url.host, int(proxy_url.port)))
ValueError: invalid literal for int() with base 10: 'password@proxy.server.net'

Original comment by christop...@gmail.com on 23 Jul 2010 at 6:21

GoogleCodeExporter commented 9 years ago
I just submitted a patch that will fix this issue: 
http://codereview.appspot.com/2915041

Poking around the source code, however, I found something that should work.

Set the environment variables proxy_username and proxy_password, and take that 
info out of http_proxy and https_proxy. That is, go from this:

http_proxy=http://user:password@host:port

to

http_proxy=http://host:port
proxy_username=user
proxy_password=password

Original comment by tom.h.mi...@gmail.com on 4 Nov 2010 at 11:16

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by tom.h.mi...@gmail.com on 5 Nov 2010 at 8:09

GoogleCodeExporter commented 9 years ago
For the sake of accuracy, the patch mentioned in comment 2 does NOT fix the 
issue, there is an accompanying patch here: 
http://codereview.appspot.com/2945041/ that should finish the job.

Original comment by tom.h.mi...@gmail.com on 10 Nov 2010 at 8:05

GoogleCodeExporter commented 9 years ago
as of revision 4777ecf2f5, this is fixed.  While this just missed the 2.0.13 
release, you can apply the change by downloading the patch here: 
http://codereview.appspot.com/2945041/ and applying it to 2.0.13

Original comment by tom.h.mi...@gmail.com on 17 Nov 2010 at 7:20