GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — gh-102327: Extend docs for "url" and "headers" parameters to HTTPConnection.request() by davidfstr · Pull Request #102328 · python/cpython Conversation
|
|
Looks good overall, I think this provides clarity to the doc. One comment, and I'm being nitpicky here, can we use a different URL in the example, instead of xkcd? Can we use python.org as example? Or other Python-related website. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sure. I'll tentatively put in: https://docs.python.org/3/ That URL satisfies the following useful conditions:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
What do you think of moving the doc for The example could be kept at the end, after the documentation of each parameter. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@merwok , makes sense. I'll plan to integrate those revisions later today. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty great now!
Thanks for the screenshots. Note that pull requests have automatic preview websites for docs, which are even better to see results easily (although sometimes the link is a bit hidden):
https://cpython-previews--102328.org.readthedocs.build/en/102328/library/http.client.html#httpconnection-objects
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| method *method* and the selector *url*. | ||
| method *method* and the request URI *url*. The provided *url* must be | ||
| an absolute path to conform with :rfc:`RFC 2616 §5.1.2 <2616#section-5.1.2>` | ||
| when using most HTTP methods (like ``GET`` or ``POST``). |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This line makes me wonder if PUT and PATCH are part of «most HTTP methods», so I have to follow the RFC link to see. It seems that yes, only OPTIONS * is given as a counter-example. I wonder if there is a way to rephrase that so that casual readers take away that url should nearly always be an absolute path, see link for exact rules.
What do other people think?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
A more specific phrasing would be:
The provided *url* must be an absolute path to conform with :rfc:`RFC 2616 §5.1.2 <2616#section-5.1.2>`, unless connecting to an HTTP proxy server or using the ``OPTIONS`` or ``CONNECT`` methods.
And further down:
A :rfc:`Host header <2616#section-14.23>` must be provided to conform with :rfc:`RFC 2616 §5.1.2 <2616#section-5.1.2>`, unless connecting to an HTTP proxy server or using the ``OPTIONS`` or ``CONNECT`` methods.
A reader would still have to follow the link to determine the actual rules if they were talking to an HTTP proxy server (somewhat common?) or using OPTIONS/CONNECT (rare?).
Comments?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
That’s very clear! The unless clause could even be in parentheses.
I never use proxies but I think there are two cases:
GET https://authority/path on a connection opened to http://proxyhttp_proxy or https_proxy environment variablesI suppose the note here applies to the first kind only?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Feedback applied. I think this change is ready to merge!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could you reply to the question about proxy? 🙂
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
RFC 2616 §1.3 defines a "proxy" as:
An intermediary program which acts as both a server and a client
for the purpose of making requests on behalf of other clients.
Requests are serviced internally or by passing them on, with
possible translation, to other servers. A proxy MUST implement
both the client and server requirements of this specification. A
"transparent proxy" is a proxy that does not modify the request or
response beyond what is required for proxy authentication and
identification. A "non-transparent proxy" is a proxy that modifies
the request or response in order to provide some added service to
the user agent, such as group annotation services, media type
transformation, protocol reduction, or anonymity filtering. Except
where either transparent or non-transparent behavior is explicitly
stated, the HTTP proxy requirements apply to both types of
proxies.
Therefore I speculate that the following requirement from §5.1.2 applies when a Python program attempts to connect to any kind of proxy:
The absoluteURI form is REQUIRED when the request is being made to a
proxy.
I never use proxies myself so I have no empirical experience one way or the other.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
OK, let’s hope the people using proxies know how to handle them!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Note for the dev who will merge: please edit the commit message to avoid reusing the whole original post here with its questions and screenshot |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
What are the next steps to move this review forward?
(1) Would it be helpful if I squashed/rebased this commit to the tip of the main branch? (2) Do I need to summon someone with merge permissions? If so, is there a list of such folks publicly listed? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I will re-review later today from computer. Thanks. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
The approval was reset by me actually, not a title change! Note that all PRs for CPython are squash merged, so rebases are not needed. (In fact the devguide recommends against them, as force pushes do weird things for reviewers: ghost notifications, comments losing context) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @davidfstr for the PR, and @Mariatta for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.