Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docstrings for req.host and req.remote #2607

Merged
merged 1 commit into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/2591.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix docstring for request.host
1 change: 1 addition & 0 deletions CHANGES/2592.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix docstring for request.remote
20 changes: 11 additions & 9 deletions aiohttp/web_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ def forwarded(self):
def scheme(self):
"""A string representing the scheme of the request.

Hostname is resolved in this order:

- overridden value by .clone(scheme=new_scheme) call.
- type of connection to peer: HTTPS if socket is SSL, HTTP otherwise.

'http' or 'https'.
"""
scheme = self._scheme
Expand Down Expand Up @@ -285,13 +290,11 @@ def version(self):
def host(self):
"""Hostname of the request.

Hostname is resolved through the following headers, in this order:

- Forwarded
- X-Forwarded-Host
- Host
Hostname is resolved in this order:

Returns str, or None if no hostname is found in the headers.
- overridden value by .clone(host=new_host) call.
- HOST HTTP header
- socket.getfqdn() value
"""
host = self._host
if host is not None:
Expand All @@ -306,10 +309,9 @@ def host(self):
def remote(self):
"""Remote IP of client initiated HTTP request.

The IP is resolved through the following headers, in this order:
The IP is resolved in this order:

- Forwarded
- X-Forwarded-For
- overridden value by .clone(remote=new_remote) call.
- peername of opened socket
"""
remote = self._remote
Expand Down