Merge pull request #1767 from benoitc/fix/1766/unix-socket-secure-scheme-headers

Fix secure scheme headers for UNIX sockets
This commit is contained in:
Randall Leeds 2018-04-30 11:34:44 -07:00 committed by GitHub
commit 92ae609f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,7 @@ from gunicorn.http.errors import (InvalidHeader, InvalidHeaderName, NoMoreData,
LimitRequestLine, LimitRequestHeaders) LimitRequestLine, LimitRequestHeaders)
from gunicorn.http.errors import InvalidProxyLine, ForbiddenProxyRequest from gunicorn.http.errors import InvalidProxyLine, ForbiddenProxyRequest
from gunicorn.http.errors import InvalidSchemeHeaders from gunicorn.http.errors import InvalidSchemeHeaders
from gunicorn.six import BytesIO from gunicorn.six import BytesIO, string_types
from gunicorn.util import split_request_uri from gunicorn.util import split_request_uri
MAX_REQUEST_LINE = 8190 MAX_REQUEST_LINE = 8190
@ -76,6 +76,8 @@ class Message(object):
remote_host = remote_addr[0] remote_host = remote_addr[0]
if remote_host in cfg.forwarded_allow_ips: if remote_host in cfg.forwarded_allow_ips:
secure_scheme_headers = cfg.secure_scheme_headers secure_scheme_headers = cfg.secure_scheme_headers
elif isinstance(remote_addr, string_types):
secure_scheme_headers = cfg.secure_scheme_headers
# Parse headers into key/value pairs paying attention # Parse headers into key/value pairs paying attention
# to continuation lines. # to continuation lines.