Skip to content

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Mar 23, 2018

(cherry picked from commit 8bcfa02)

Co-authored-by: Julien Palard julien@palard.fr

https://bugs.python.org/issue31639

(cherry picked from commit 8bcfa02)

Co-authored-by: Julien Palard <julien@palard.fr>
@miss-islington
Copy link
Contributor Author

@JulienPalard: Backport status check is done, and it's a success ✅ .

Copy link
Member

@ned-deily ned-deily left a comment

Choose a reason for hiding this comment

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

+0 I'm not sure that is appropriate for 3.6.x at this stage but I'm willing to be persuaded. BTW, I believe all of the comments apply to the 3.7 and master versions of the changes. I'm too lazy to duplicate.

of which this module provides three different variants:
This class is identical to HTTPServer but uses threads to handle
requests by using the :class:`~socketserver.ThreadingMixin`. This
is usefull to handle web browsers pre-opening sockets, on which
Copy link
Member

Choose a reason for hiding this comment

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

usefull -> useful

Copy link
Member

Choose a reason for hiding this comment

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

As it's a backport, should I simply fix it in a new PR?

Copy link
Member

Choose a reason for hiding this comment

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

Since the master and 3.7 versions are already merged, that would be simpler, sure.

@@ -0,0 +1,2 @@
http.server now exposes a ThreadedHTTPServer class and uses it when the
module is invoked to cope with web browsers pre-opening sockets.
Copy link
Member

Choose a reason for hiding this comment

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

"and uses it when the module is invoked" ? Doesn't the user have to explicitly use the new class?

Copy link
Member

Choose a reason for hiding this comment

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

By "module is invoked" I mean running "python3 -m http.server". In the "python -m http.server" case, the ThreadedHTTPServer is used, to fix bpo-31639.

Copy link
Member

Choose a reason for hiding this comment

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

So perhaps change "is invoked" to "is run with -m" ?


The :class:`HTTPServer` and :class:`ThreadedHTTPServer` must be given
a *RequestHandlerClass* on instantiation, of which this module
provides three different variants:
Copy link
Member

Choose a reason for hiding this comment

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

Needs a version added comment.

Copy link
Member

Choose a reason for hiding this comment

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

You're right. Hum, what is the protocol to decide which version to put it as it's being backported? I initially though 3.8 but as it's backported ... maybe 3.6 but it's wrong (as not precise enough, it was not present in 3.6.*), so maybe versionadded:: 3.6.6?

Copy link
Member

Choose a reason for hiding this comment

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

I think 3.6.6 is the right answer in this case for all branches.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@JulienPalard
Copy link
Member

@ned-deily thanks for the feedback. I think it's ok for 3.6 (not as a language bug fix I agree, but as a usability fix): I encontered the issue multiple time by using "python3 -m http.server", typically to test the doc. I expect other people to find the bug too.

@ned-deily
Copy link
Member

OK, I guess this is OK for 3.6. If you want to address some or all of the comments in a follow-on PR for master and 3.7, that's fine.

@JulienPalard
Copy link
Member

As discussed with @vstinner, I'll finally won't backport it to 3.6: introducing a new class (changing the API) is something we should not do. It's still fixable without changing the API by hiding the ThreadedHTTPServer class in the test function if someone want to do it.

@geryogam
Copy link
Contributor

geryogam commented May 28, 2018

@JulienPalard @miss-islington Thanks for this PR. However what do you think about changing the class name http.server.ThreadedHTTPServer to http.server.ThreadingHTTPServer, in order to be consistent with the already existing classes:

  • socketserver.ForkingTCPServer;
  • socketserver.ForkingUDPServer;
  • socketserver.ThreadingTCPServer;
  • socketserver.ThreadingUDPServer.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants