Undocumented
Function | get |
Returns the content length as an integer or ``None`` if unavailable or chunked transfer encoding is used. |
Function | get |
Recreate the URL for a request. If an optional part isn't provided, it and subsequent parts are not included in the URL. |
Function | get |
Return the host for the given parameters. |
Function | host |
Check if a host matches a list of trusted names. |
t.Union[ str, None]
= None, http_transfer_encoding: t.Union[ str, None]
= '') -> t.Optional[ int]
:
(source)
¶
Returns the content length as an integer or ``None`` if unavailable or chunked transfer encoding is used. :param http_content_length: The Content-Length HTTP header. :param http_transfer_encoding: The Transfer-Encoding HTTP header. .. versionadded:: 2.2
str
, host: str
, root_path: t.Optional[ str]
= None, path: t.Optional[ str]
= None, query_string: t.Optional[ bytes]
= None) -> str
:
(source)
¶
Recreate the URL for a request. If an optional part isn't provided, it and subsequent parts are not included in the URL. The URL is an IRI, not a URI, so it may contain Unicode characters. Use :func:`~werkzeug.urls.iri_to_uri` to convert it to ASCII. :param scheme: The protocol the request used, like ``"https"``. :param host: The host the request was made to. See :func:`get_host`. :param root_path: Prefix that the application is mounted under. This is prepended to ``path``. :param path: The path part of the URL after ``root_path``. :param query_string: The portion of the URL after the "?".
str
, host_header: t.Optional[ str]
, server: t.Optional[ t.Tuple[ str, t.Optional[ int]]]
= None, trusted_hosts: t.Optional[ t.Iterable[ str]]
= None) -> str
:
(source)
¶
Return the host for the given parameters. This first checks the ``host_header``. If it's not present, then ``server`` is used. The host will only contain the port if it is different than the standard port for the protocol. Optionally, verify that the host is trusted using :func:`host_is_trusted` and raise a :exc:`~werkzeug.exceptions.SecurityError` if it is not. :param scheme: The protocol the request used, like ``"https"``. :param host_header: The ``Host`` header value. :param server: Address of the server. ``(host, port)``, or ``(path, None)`` for unix sockets. :param trusted_hosts: A list of trusted host names. :return: Host, with port if necessary. :raise ~werkzeug.exceptions.SecurityError: If the host is not trusted.