Skip to content

[BUG] AsgiRequest hard codes scheme as 'https' in scope #1185

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

Closed
jasonchester opened this issue Feb 24, 2023 · 4 comments · Fixed by Azure/azure-functions-python-library#198

Comments

@jasonchester
Copy link

Investigative information

Repro steps

Expected behavior

Scheme should either be http or https depending on the request being handled.

Actual behavior

Scheme is hard coded as https

Known workarounds

Contents of the requirements.txt file:

Related information

https://asgi.readthedocs.io/en/latest/specs/www.html

  • Links to source

https://github.com/Azure/azure-functions-python-library/blob/cc3fd5d13770244bdcc1030be608c81d50df1ad2/azure/functions/_http_asgi.py#L32-L62

  • Bindings used
@jasonchester jasonchester changed the title [BUG] AsgiApplication hard codes scheme as 'https' in scope [BUG] AsgiRequest hard codes scheme as 'https' in scope Feb 24, 2023
@bhagyshricompany bhagyshricompany self-assigned this Feb 27, 2023
@bhagyshricompany
Copy link

Thanks for update will inform

@bhagyshricompany
Copy link

Issue needs mechanism to parse the scheme for incoming url.
So will update on this once done.

@jasonchester
Copy link
Author

@bhagyshricompany, WsgiRequest appears to handle scheme correctly with urllib.parse.urlparse

https://github.com/Azure/azure-functions-python-library/blob/cc3fd5d13770244bdcc1030be608c81d50df1ad2/azure/functions/_http_wsgi.py

#...
from urllib.parse import ParseResult, urlparse, unquote_to_bytes
#...
class WsgiRequest:
#...
    def __init__(self,
                 func_req: HttpRequest,
                 func_ctx: Optional[Context] = None):
        url: ParseResult = urlparse(func_req.url)
#...
        self.wsgi_url_scheme = url.scheme
 
#...

@bhagyshricompany
Copy link

@gavin-aguiar pls comment and update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants