8000 fix get_raw_path parsing by bentsku · Pull Request #8962 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

fix get_raw_path parsing #8962

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

Merged
merged 1 commit into from
Aug 22, 2023
Merged

fix get_raw_path parsing #8962

merged 1 commit into from
Aug 22, 2023

Conversation

bentsku
Copy link
Contributor
@bentsku bentsku commented Aug 22, 2023

Motivation

This PR would fix #8928 and #8924. We had an issue with parsing the WSGI environ RAW_URI, because an HTTP request can also contain a full URL and not only an absolute path. See the RFC: https://www.ietf.org/rfc/rfc2616.txt

   To allow for transition to absoluteURIs in all requests in future
   versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI
   form in requests, even though HTTP/1.1 clients will only generate
   them in requests to proxies.

We would then have more than the path with get_raw_path, which lead to issue down the road when trying to match in our router.

Changes

We now thanks to @dfangl parse the RAW_URI variable with urllib.parse.urlparse to then only get the path part of the RAW_URI in case there's more.
Added a unit test covering this use case.

@bentsku bentsku added area: asf semver: patch Non-breaking changes which can be included in patch releases labels Aug 22, 2023
@bentsku bentsku self-assigned this Aug 22, 2023
@bentsku bentsku requested a review from dfangl August 22, 2023 16:22
@bentsku bentsku marked this pull request as ready for review August 22, 2023 16:24
@bentsku bentsku requested a review from thrau as a code owner August 22, 2023 16:24
@bentsku bentsku linked an issue Aug 22, 2023 that may be closed by this pull request
1 task
@coveralls
Copy link

Coverage Status

coverage: 80.725% (+0.07%) from 80.658% when pulling 00c22b0 on fix-raw-uri-parsing into dacb3c8 on master.

Copy link
Member
@dfangl dfangl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: asf semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: LocalStack.NET all S3 operations fails on LocalStack 2.2 bug: LocalStack.NET SQS DeleteQueue fails on LocalStack 2.2
3 participants
0