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 a web page using URLopener.open() in urllib, the object
returned is missing the protocol in its 'url' member.
Specifically, the class method open_http(), which is called from
URLopener.open(),drops the protocol.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Following is a printout of how to reproduce the bug in an interactive
python session (launch python at command line):
Python 1.5.2 (#1, Jul 5 2001, 03:02:19) [GCC 2.96 20000731 (Red Hat
Linux 7.1 2 on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import urllib
>>> retriever = urllib.URLopener()
>>> webdoc = retriever.open('http://www.yahoo.com')
>>> print webdoc.url
Note that "webdoc.url" should also include the protocol. Red Hat's
version of Python 1.5.2 doesn't.
Actual Results: The object returned from URLopener.open() is missing a
protocol in its 'url' class member.
Expected Results: The object returned should have the protocol included
in the 'url' member.
This is specific to Red Hat's version of Pyton 1.5.2
I have a patch available which I will try to upload to bugzilla.
Created attachment 40187 [details]
patches /usr/lib/python1.5/urllib.py in Red Hat 7.1 and 7.2
A different patch is to initialise urltype to "http" on line 229.
This is fixed in python 2.2, e.g. 2.2.1-16