Skip to content

Commit

Permalink
Merge pull request #20 from donbowman/fix-no-port-host
Browse files Browse the repository at this point in the history
fix: use None if no port present on Host: header in quart
  • Loading branch information
bobbui authored May 18, 2019
2 parents 01ba0f3 + a7dc311 commit 41f4f5d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion json_logging/framework/quart/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ def get_remote_ip(self, request):
return request.remote_addr

def get_remote_port(self, request):
return request.host.split(":", 2)[1]
return (
request.host.split(":", 2)[1]
if len(request.host.split(":", 2)) == 2
else None
)


class QuartResponseAdapter(ResponseAdapter):
Expand Down

0 comments on commit 41f4f5d

Please sign in to comment.