From b77c6c1ddc8b9904c2080d8259a33da3d5715d56 Mon Sep 17 00:00:00 2001 From: "finnur@chromium.org" Date: Fri, 2 Oct 2009 17:59:55 +0000 Subject: The Python test server now ignores querystrings params when serving local files. I'm having no luck getting the try bots to recognize this change to the python file, so I am separating my already LG'ed changelist (http://codereview.chromium.org/246066) into two (this part and a followup patch) in the hopes that my tests (next CL) will succeed. I fixed our python test server to serve files even though there is a querystring in the url (the server basically just ignores the querystring). This is needed in my next cl because the html we serve has js that acts on data in the querystring. Also made it have the right content-header when serving xml files (text/html). TBR=aa BUG=None TEST=None Review URL: http://codereview.chromium.org/242120 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27862 0039d316-1c4b-4281-b951-d872f2087c98 --- net/tools/testserver/testserver.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'net/tools') diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py index 065ea7b..b80a939 100644 --- a/net/tools/testserver/testserver.py +++ b/net/tools/testserver/testserver.py @@ -134,7 +134,8 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler): self._mime_types = { 'gif': 'image/gif', 'jpeg' : 'image/jpeg', - 'jpg' : 'image/jpeg' + 'jpg' : 'image/jpeg', + 'xml' : 'text/xml' } self._default_mime_type = 'text/html' @@ -586,7 +587,12 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler): self.rfile.read(int(self.headers.getheader('content-length'))) file = self.path[len(prefix):] - entries = file.split('/'); + if file.find('?') > -1: + # Ignore the query parameters entirely. + url, querystring = file.split('?') + else: + url = file + entries = url.split('/') path = os.path.join(self.server.data_dir, *entries) if os.path.isdir(path): path = os.path.join(path, 'index.html') -- cgit v1.1