Bug 57295 - Python 2.1.1 urllib.py open_https() drops protocol
Python 2.1.1 urllib.py open_https() drops protocol
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: python (Show other bugs)
7.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Trond Eivind Glomsrxd
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-12-08 21:35 EST by Joe Antao
Modified: 2007-04-18 12:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-08-14 12:35:57 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patches /usr/lib/python2.1/urllib.py (634 bytes, patch)
2001-12-08 21:36 EST, Joe Antao
no flags Details | Diff

  None (edit)
Description Joe Antao 2001-12-08 21:35:07 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6) Gecko/20011120

Description of problem:
When retrieving an https web page using URLopener.open() in urllib, the
object returned is missing the protocol in its 'url' member.

Specifically, the class method open_https(), which is called from
URLopener.open(),drops the protocol.




Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
The following example is from an interactive python session:

$ python
Python 2.1.1 (#1, Aug 13 2001, 19:37:40) 
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-96)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import urllib
>>> retriever = urllib.URLopener()
>>> webpage = retriever.open('http://www.yahoo.com')
>>> print webpage.url
http://www.yahoo.com
>>> webpage = retriever.open('https://aims.parl.com')
>>> print webpage.url
//aims.parl.com
>>> 


Actual Results:  Notice that when retrieving a web page with http
protocol, the object returned has its protocol intact in its 'url' class
member.

When retrieving a page using the https protocol, the protocol is missing
in the 'url' class member.

Expected Results:  The object returned from the https web page should
have the protocol included in its 'url' class member.

Additional info:

Bug is caused in urllib module located in /usr/lib/python2.1/urllib.py.

Comparing the open_http() and open_https() URLopener class methods, you can
see the difference (and cause of bug) in the return statement that calls
addinfourl(). 

I will upload a patch to fix this.
Comment 1 Joe Antao 2001-12-08 21:36:22 EST
Created attachment 40188 [details]
patches /usr/lib/python2.1/urllib.py
Comment 2 Trond Eivind Glomsrxd 2002-08-14 12:50:39 EDT
Fixed in 2.2.1-16, and most likely other 2.2 versions as well.

Note You need to log in before you can comment on or make changes to this bug.