Comment 1 for bug 1542370

Revision history for this message
Vitalii Kulanov (vitaliy-t) wrote :

In our case http://localhost:80 is not a valid proxy server.
Besides that we have apache redirect to Fuel Web interface on port 80
(https://github.com/openstack/fuel-library/commit/d60233a0cba912faa2170f9f8979360ff0740c55
https://bugs.launchpad.net/fuel/+bug/1270187)

So if we try to use localhost as a proxy server we get url parse exception:

File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/url.py", line 187, in parse_url
    raise LocationParseError(url)
requests.packages.urllib3.exceptions.LocationParseError: Failed to parse: archive.ubuntu.com:8000:8000

Some examples (localhost as a proxy):

[root@fuel ~]# curl -x localhost:80 -I http://example.com
HTTP/1.1 301 Moved Permanently
Date: Wed, 02 Mar 2016 07:06:34 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Location: https://example.com:8443/
Content-Type: text/html; charset=iso-8859-1

[root@fuel ~]# curl -x localhost:80 -I http://example.com/test
HTTP/1.1 301 Moved Permanently
Date: Wed, 02 Mar 2016 07:52:03 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Location: http://example.com:8000/test
Content-Type: text/html; charset=iso-8859-1

[root@fuel ~]# curl -x localhost:80 -I http://example.com:8000/test
HTTP/1.1 301 Moved Permanently
Date: Wed, 02 Mar 2016 07:54:33 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Location: http://example.com:8000:8000/test
Content-Type: text/html; charset=iso-8859-1

Example for some valid proxy:

[root@fuel ~]# curl -x 195.154.231.43:80 -I http://example.com
HTTP/1.1 200 OK
Date: Wed, 02 Mar 2016 08:32:25 GMT
Server: Apache/2.2.22 (Ubuntu)
Last-Modified: Wed, 28 May 2014 10:38:19 GMT
ETag: "bc0b89-b1-4fa73693161c7"
Accept-Ranges: bytes
Content-Length: 177
Vary: Accept-Encoding
Content-Type: text/html
X-Pad: avoid browser bug

So, I think that we have to add some function that will check 'validity' of proxy server
before creating any get request through.