From 1dd854f80bfe25ee461bb117f92fa81f2f5bb081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=2E=20K=C3=A4rkk=C3=A4inen?= Date: Sat, 20 Jul 2019 16:58:37 +0300 Subject: [PATCH] Update docstrings to incidate that forwarded header is used first. --- sanic/request.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sanic/request.py b/sanic/request.py index b638d1b5..61434567 100644 --- a/sanic/request.py +++ b/sanic/request.py @@ -365,7 +365,7 @@ class Request(dict): def server_name(self): """ Attempt to get the server's hostname in this order: - `config.SERVER_NAME`, `x-forwarded-host` header, :func:`Request.host` + `config.SERVER_NAME`, `forwarded` header, `x-forwarded-host` header, :func:`Request.host` :return: the server name without port number :rtype: str @@ -406,9 +406,9 @@ class Request(dict): @property def remote_addr(self): - """Attempt to return the original client ip based on X-Forwarded-For - or X-Real-IP. If HTTP headers are unavailable or untrusted, returns - an empty string. + """Attempt to return the original client ip based on `forwarded`, + `x-forwarded-for` or `x-real-ip`. If HTTP headers are unavailable or + untrusted, returns an empty string. :return: original client ip. """ @@ -421,7 +421,8 @@ class Request(dict): """ Attempt to get the request scheme. Seeking the value in this order: - `x-forwarded-proto` header, `x-scheme` header, the sanic app itself. + `forwarded` header, `x-forwarded-proto` header, + `x-scheme` header, the sanic app itself. :return: http|https|ws|wss or arbitrary value given by the headers. :rtype: str