diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2008-06-18 20:49:58 +0000 |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2008-06-18 20:49:58 +0000 |
commit | 1afc1696167547a5fa101c53e5a3ab4717f8852c (patch) | |
tree | e989e72e71530d892214562785df7e11f84c1111 /Lib/http/server.py | |
parent | a656d2cd8984f1ecb5a7e2cd09a18f72452f2b78 (diff) | |
download | cpython-git-1afc1696167547a5fa101c53e5a3ab4717f8852c.tar.gz |
Make a new urllib package .
It consists of code from urllib, urllib2, urlparse, and robotparser.
The old modules have all been removed. The new package has five
submodules: urllib.parse, urllib.request, urllib.response,
urllib.error, and urllib.robotparser. The urllib.request.urlopen()
function uses the url opener from urllib2.
Note that the unittests have not been renamed for the
beta, but they will be renamed in the future.
Joint work with Senthil Kumaran.
Diffstat (limited to 'Lib/http/server.py')
-rw-r--r-- | Lib/http/server.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py index 35ade6c015..6259a4d269 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -93,7 +93,7 @@ import cgi import time import socket # For gethostbyaddr() import shutil -import urllib +import urllib.parse import select import mimetypes import posixpath @@ -683,7 +683,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): return None list.sort(key=lambda a: a.lower()) r = [] - displaypath = cgi.escape(urllib.unquote(self.path)) + displaypath = cgi.escape(urllib.parse.unquote(self.path)) r.append('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">') r.append("<html>\n<title>Directory listing for %s</title>\n" % displaypath) r.append("<body>\n<h2>Directory listing for %s</h2>\n" % displaypath) @@ -699,7 +699,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): displayname = name + "@" # Note: a link to a directory displays with @ and links with / r.append('<li><a href="%s">%s</a>\n' - % (urllib.quote(linkname), cgi.escape(displayname))) + % (urllib.parse.quote(linkname), cgi.escape(displayname))) r.append("</ul>\n<hr>\n</body>\n</html>\n") enc = sys.getfilesystemencoding() encoded = ''.join(r).encode(enc) @@ -723,7 +723,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): # abandon query parameters path = path.split('?',1)[0] path = path.split('#',1)[0] - path = posixpath.normpath(urllib.unquote(path)) + path = posixpath.normpath(urllib.parse.unquote(path)) words = path.split('/') words = filter(None, words) path = os.getcwd() @@ -947,7 +947,7 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): env['SERVER_PROTOCOL'] = self.protocol_version env['SERVER_PORT'] = str(self.server.server_port) env['REQUEST_METHOD'] = self.command - uqrest = urllib.unquote(rest) + uqrest = urllib.parse.unquote(rest) env['PATH_INFO'] = uqrest env['PATH_TRANSLATED'] = self.translate_path(uqrest) env['SCRIPT_NAME'] = scriptname |