Skip to content
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

Fix Authentication Issue with Double Slashes in URL #26

Closed
wants to merge 2 commits into from

Conversation

cosineai[bot]
Copy link

@cosineai cosineai bot commented Aug 28, 2024

Summary

This PR addresses the issue where URLs containing double slashes (//) in the path result in authentication failures. The problem was identified as being related to the changes introduced in psf#6644, which did not properly handle double slashes in the URL path.

Changes

  • Added a new utility function _remove_path_dot_segments in src/requests/utils.py to normalize URL paths by removing dot segments and reducing double slashes to a single slash.
  • Updated the URL path processing to use this new function, ensuring consistent behavior and successful authentication.

Testing

  • Verified that URLs with double slashes are correctly normalized and authentication succeeds as expected.

Issue

Fixes the authentication issue described in the task, ensuring similar behavior as before version 2.32.0.

Reproduction Steps

  1. Run the provided script to make a POST request to a URL with double slashes in the path.
  2. Observe that the request now succeeds without a 401 error.

System Information

  • Python: 3.11.2
  • Requests: 2.32.3
  • Platform: Linux 6.1.0-21-amd64

@JJIngram JJIngram closed this Aug 28, 2024
@JJIngram JJIngram deleted the cosine/fix/authentication-path-issue-tq1ztk branch August 28, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant