Skip to content

Commit 3ac937f

Browse files
committed
parse url scheme to allow http or https
1 parent 0ca53b3 commit 3ac937f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

azure/functions/_http_asgi.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import logging
66
import asyncio
77
from asyncio import Event, Queue
8+
from urllib.parse import ParseResult, urlparse
89
from warnings import warn
910
from wsgiref.headers import Headers
1011

@@ -22,6 +23,8 @@ def __init__(self, func_req: HttpRequest,
2223
self.asgi_version = ASGI_VERSION
2324
self.asgi_spec_version = ASGI_SPEC_VERSION
2425
self._headers = func_req.headers
26+
url: ParseResult = urlparse(func_req.url)
27+
self.asgi_url_scheme = url.scheme
2528
super().__init__(func_req, func_ctx)
2629

2730
def _get_encoded_http_headers(self) -> List[Tuple[bytes, bytes]]:
@@ -49,7 +52,7 @@ def to_asgi_http_scope(self):
4952
"asgi.spec_version": self.asgi_spec_version,
5053
"http_version": "1.1",
5154
"method": self.request_method,
52-
"scheme": "https",
55+
"scheme": self.asgi_url_scheme,
5356
"path": self.path_info,
5457
"raw_path": _raw_path,
5558
"query_string": _query_string,

0 commit comments

Comments
 (0)