diff options
| -rw-r--r-- | tests/test_wsgi.py | 12 | ||||
| -rw-r--r-- | werkzeug/wsgi.py | 8 |
2 files changed, 15 insertions, 5 deletions
diff --git a/tests/test_wsgi.py b/tests/test_wsgi.py index 53a3a529..9d2f6807 100644 --- a/tests/test_wsgi.py +++ b/tests/test_wsgi.py @@ -480,7 +480,7 @@ def test_http_proxy(dev_server): return Response(u'%s|%s|%s' % ( request.headers.get('X-Special'), request.environ['HTTP_HOST'], - request.path, + request.full_path, )) ''' @@ -509,11 +509,15 @@ def test_http_proxy(dev_server): assert rv.data == b'ROOT' rv = client.get('/foo/bar') - assert rv.data.decode('ascii') == 'foo|faked.invalid|/foo/bar' + assert rv.data.decode('ascii') == 'foo|faked.invalid|/foo/bar?' rv = client.get('/bar/baz') - assert rv.data.decode('ascii') == 'bar|localhost|/baz' + assert rv.data.decode('ascii') == 'bar|localhost|/baz?' rv = client.get('/autohost/aha') - assert rv.data.decode('ascii') == 'None|%s|/autohost/aha' % url_parse( + assert rv.data.decode('ascii') == 'None|%s|/autohost/aha?' % url_parse( server.url).ascii_host + + # test query string + rv = client.get('/bar/baz?a=a&b=b') + assert rv.data.decode('ascii') == 'bar|localhost|/baz?a=a&b=b' diff --git a/werkzeug/wsgi.py b/werkzeug/wsgi.py index c30021a7..2d4498a4 100644 --- a/werkzeug/wsgi.py +++ b/werkzeug/wsgi.py @@ -545,7 +545,13 @@ class ProxyMiddleware(object): timeout=self.timeout, context=opts['ssl_context']) con.connect() - con.putrequest(environ['REQUEST_METHOD'], url_quote(remote_path), + + remote_url = url_quote(remote_path) + querystring = environ['QUERY_STRING'] + if querystring: + remote_url = remote_url + '?' + querystring + + con.putrequest(environ['REQUEST_METHOD'], remote_url, skip_host=True) for k, v in headers: |
