[Python-Dev] FW: submitting patches against 1.6a2 (original) (raw)

Guido van Rossum guido@beopen.com
Fri, 04 Aug 2000 10:06:33 -0500


Anyone competent with urrlib care to check out this fellow's complaint?

It arrived on June 14, so I probably ignored it -- with 1000s of other messages received while I was on vacation. This was before we started using the SF PM.

But I still have his email. Someone else please look at this!

--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)

Subject: [Patches] urllib.py patch From: Paul Schreiber <paul@commerceflow.com> To: patches@python.org Date: Wed, 14 Jun 2000 16:52:02 -0700 Content-Type: multipart/mixed; boundary="------------3EE36A3787159ED881FD3EC3"

This is a multi-part message in MIME format. --------------3EE36A3787159ED881FD3EC3 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit

I confirm that, to the best of my knowledge and belief, this contribution is free of any claims of third parties under copyright, patent or other rights or interests ("claims"). To the extent that I have any such claims, I hereby grant to CNRI a nonexclusive, irrevocable, royalty-free, worldwide license to reproduce, distribute, perform and/or display publicly, prepare derivative versions, and otherwise use this contribution as part of the Python software and its related documentation, or any derivative versions thereof, at no cost to CNRI or its licensed users, and to authorize others to do so.

I acknowledge that CNRI may, at its sole discretion, decide whether or not to incorporate this contribution in the Python software and its related documentation. I further grant CNRI permission to use my name and other identifying information provided to CNRI by me for use in connection with the Python software and its related documentation.

Patch description

This addresses four issues:

(1) usernames and passwords in urls with special characters are now decoded properly. i.e. http://foo%2C:bar@www.whatever.com/

(2) Basic Auth support has been added to HTTPS, like it was in HTTP.

(3) Version 1.92 sent the POSTed data, but did not deal with errors (HTTP responses other than 200) properly. HTTPS now behaves the same way HTTP does.

(4) made URL-checking beahve the same way with HTTPS as it does with HTTP (changed == to !=).

Paul Schreiber --------------3EE36A3787159ED881FD3EC3 Content-Type: text/plain; charset=us-ascii; name="urllib-diff-2" Content-Disposition: inline; filename="urllib-diff-2" Content-Transfer-Encoding: 7bit

*** urllib.old Tue Jun 13 18:27:02 2000 --- urllib.py Tue Jun 13 18:33:27 2000


*** 302,316 **** def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib if type(url) is type(""): host, selector = splithost(url) ! user_passwd, host = splituser(host) else: host, selector = url urltype, rest = splittype(selector) ! if string.lower(urltype) == 'https': realhost, rest = splithost(rest) ! user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via https:", host, selector --- 302,325 ---- def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib

! if host: ! user_passwd, host = splituser(host) ! host = unquote(host) ! realhost = host else: host, selector = url urltype, rest = splittype(selector) ! url = rest ! user_passwd = None ! if string.lower(urltype) != 'https': ! realhost = None ! else: realhost, rest = splithost(rest) ! if realhost: ! user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via https:", host, selector


*** 331,336 **** --- 340,346 ---- else: h.putrequest('GET', selector) if auth: h.putheader('Authorization: Basic %s' % auth)


*** 340,347 **** if errcode == 200: return addinfourl(fp, headers, url) else: ! return self.http_error(url, fp, errcode, errmsg, headers) !
def open_gopher(self, url): """Use Gopher protocol.""" import gopherlib --- 350,360 ---- if errcode == 200: return addinfourl(fp, headers, url) else: ! if data is None: ! return self.http_error(url, fp, errcode, errmsg, headers) ! else: ! return self.http_error(url, fp, errcode, errmsg, headers, data) ! def open_gopher(self, url): """Use Gopher protocol.""" import gopherlib


*** 872,878 **** _userprog = re.compile('^([^@])@(.)$')

  match = _userprog.match(host)

! if match: return match.group(1, 2) return None, host

_passwdprog = None --- 885,891 ---- _userprog = re.compile('^([^@])@(.)$')

  match = _userprog.match(host)

! if match: return map(unquote, match.group(1, 2)) return None, host

_passwdprog = None

--------------3EE36A3787159ED881FD3EC3--


Patches mailing list Patches@python.org http://www.python.org/mailman/listinfo/patches