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

bpo-38216, bpo-36274: Allow subclasses to separately override validation and encoding behavior #16448

Merged
merged 10 commits into from Sep 28, 2019

Conversation

@jaraco
Copy link
Member

jaraco commented Sep 28, 2019

This PR builds on and supersedes #16321 as an alternative approach for consideration.

https://bugs.python.org/issue38216

jaraco and others added 10 commits Sep 20, 2019
…alidation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.
This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.
…ally simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path.
Lib/http/client.py Show resolved Hide resolved
Copy link
Member

ned-deily left a comment

LGTM, and I also prefer this approach. Thanks!

@jaraco jaraco merged commit 7774d78 into python:master Sep 28, 2019
4 checks passed
4 checks passed
Azure Pipelines PR #20190928.5 succeeded
Details
bedevere/issue-number Issue number 38216 found
Details
bedevere/news News entry found in Misc/NEWS.d
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jaraco jaraco deleted the jaraco:feature/38216-putrequest-hooks-separate branch Sep 28, 2019
@miss-islington

This comment has been minimized.

Copy link

miss-islington commented Sep 28, 2019

Thanks @jaraco for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7, 3.8.
🐍🍒🤖

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Sep 28, 2019

GH-16460 is a backport of this pull request to the 3.8 branch.

@miss-islington

This comment has been minimized.

Copy link

miss-islington commented Sep 28, 2019

Sorry, @jaraco, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 7774d7831e8809795c64ce27f7df52674581d298 3.7

@miss-islington miss-islington assigned jaraco and unassigned gpshead Sep 28, 2019
@miss-islington

This comment has been minimized.

Copy link

miss-islington commented Sep 28, 2019

Sorry @jaraco, I had trouble checking out the 3.6 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 7774d7831e8809795c64ce27f7df52674581d298 3.6

jaraco added a commit to jaraco/cpython that referenced this pull request Sep 28, 2019
…alidation and encoding behavior (pythonGH-16448)

* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path..
(cherry picked from commit 7774d78)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Sep 28, 2019

GH-16461 is a backport of this pull request to the 3.7 branch.

jaraco added a commit to jaraco/cpython that referenced this pull request Sep 28, 2019
…alidation and encoding behavior (pythonGH-16448)

* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path..
(cherry picked from commit 7774d78)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Sep 28, 2019

GH-16462 is a backport of this pull request to the 3.6 branch.

jaraco added a commit that referenced this pull request Sep 28, 2019
…alidation and encoding behavior (GH-16448) (GH-16461)

* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path..
(cherry picked from commit 7774d78)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
miss-islington added a commit that referenced this pull request Sep 28, 2019
…ion and encoding behavior (GH-16448)

* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path.
(cherry picked from commit 7774d78)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
ned-deily added a commit that referenced this pull request Sep 28, 2019
…alidation and encoding behavior (GH-16448) (GH-16462)

(cherry picked from commit 7774d78)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
jaraco added a commit to jaraco/cpython that referenced this pull request Sep 29, 2019
…alidation and encoding behavior (pythonGH-16448)

* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path..
(cherry picked from commit 7774d78)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
@jaraco

This comment has been minimized.

Copy link
Member Author

jaraco commented Sep 29, 2019

GH-16475 is a backport of this pull request to the 3.5 branch.

jaraco added a commit to jaraco/cpython that referenced this pull request Sep 29, 2019
…alidation and encoding behavior (pythonGH-16448)

* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path..
(cherry picked from commit 7774d78)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
@jaraco

This comment has been minimized.

Copy link
Member Author

jaraco commented Sep 29, 2019

GH-16476 is a backport of this pull request to the 2.7 branch.

jaraco added a commit to jaraco/cpython that referenced this pull request Sep 29, 2019
…alidation and encoding behavior (pythonGH-16448)

* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path..
(cherry picked from commit 7774d78)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
larryhastings added a commit that referenced this pull request Oct 8, 2019
…alidation and encoding behavior (GH-16448) (#16475)

* [3.5] bpo-38216, bpo-36274: Allow subclasses to separately override validation and encoding behavior (GH-16448)
jacobneiltaylor added a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
…ion and encoding behavior (pythonGH-16448)

* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.