Skip to content

Commit 2ab2b86

Browse files
authored
Merge pull request #59 from betatim/fix-port-handling
Convert port number to string before building URL
2 parents cd31b79 + 1cfa677 commit 2ab2b86

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nbserverproxy/handlers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ async def proxy(self, port, proxied_path):
239239
# headers to see if and where they are being proxied from. We set
240240
# them to be {base_url}/proxy/{port}.
241241
headers['X-Forwarded-Context'] = headers['X-ProxyContextPath'] = \
242-
url_path_join(self.base_url, 'proxy', port)
242+
url_path_join(self.base_url, 'proxy', str(port))
243243

244244
req = httpclient.HTTPRequest(
245245
client_uri, method=self.request.method, body=body,
@@ -262,7 +262,7 @@ async def proxy(self, port, proxied_path):
262262

263263
for header, v in response.headers.get_all():
264264
if header not in ('Content-Length', 'Transfer-Encoding',
265-
'Content-Encoding', 'Connection'):
265+
'Content-Encoding', 'Connection'):
266266
# some header appear multiple times, eg 'Set-Cookie'
267267
self.add_header(header, v)
268268

@@ -482,6 +482,7 @@ def patch(self, path):
482482
def options(self, path):
483483
return self.proxy(self.port, path)
484484

485+
485486
def setup_handlers(web_app):
486487
host_pattern = '.*$'
487488
web_app.add_handlers('.*', [

0 commit comments

Comments
 (0)