Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
8bcfa02e
Unverified
Kaydet (Commit)
8bcfa02e
authored
Mar 23, 2018
tarafından
Julien Palard
Kaydeden (comit)
GitHub
Mar 23, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-31639: Use threads in http.server module. (GH-5018)
üst
a0a42d22
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
+18
-4
http.server.rst
Doc/library/http.server.rst
+9
-2
server.py
Lib/http/server.py
+7
-2
2017-12-27-21-55-19.bpo-31639.l3avDJ.rst
...S.d/next/Library/2017-12-27-21-55-19.bpo-31639.l3avDJ.rst
+2
-0
No files found.
Doc/library/http.server.rst
Dosyayı görüntüle @
8bcfa02e
...
@@ -33,9 +33,16 @@ handler. Code to create and run the server looks like this::
...
@@ -33,9 +33,16 @@ handler. Code to create and run the server looks like this::
:attr:`server_port`. The server is accessible by the handler, typically
:attr:`server_port`. The server is accessible by the handler, typically
through the handler's :attr:`server` instance variable.
through the handler's :attr:`server` instance variable.
.. class:: ThreadedHTTPServer(server_address, RequestHandlerClass)
The :class:`HTTPServer` must be given a *RequestHandlerClass* on instantiation,
This class is identical to HTTPServer but uses threads to handle
of which this module provides three different variants:
requests by using the :class:`~socketserver.ThreadingMixin`. This
is usefull to handle web browsers pre-opening sockets, on which
:class:`HTTPServer` would wait indefinitly.
The :class:`HTTPServer` and :class:`ThreadedHTTPServer` must be given
a *RequestHandlerClass* on instantiation, of which this module
provides three different variants:
.. class:: BaseHTTPRequestHandler(request, client_address, server)
.. class:: BaseHTTPRequestHandler(request, client_address, server)
...
...
Lib/http/server.py
Dosyayı görüntüle @
8bcfa02e
...
@@ -83,7 +83,7 @@ XXX To do:
...
@@ -83,7 +83,7 @@ XXX To do:
__version__
=
"0.6"
__version__
=
"0.6"
__all__
=
[
__all__
=
[
"HTTPServer"
,
"BaseHTTPRequestHandler"
,
"HTTPServer"
,
"
ThreadedHTTPServer"
,
"
BaseHTTPRequestHandler"
,
"SimpleHTTPRequestHandler"
,
"CGIHTTPRequestHandler"
,
"SimpleHTTPRequestHandler"
,
"CGIHTTPRequestHandler"
,
]
]
...
@@ -140,6 +140,10 @@ class HTTPServer(socketserver.TCPServer):
...
@@ -140,6 +140,10 @@ class HTTPServer(socketserver.TCPServer):
self
.
server_port
=
port
self
.
server_port
=
port
class
ThreadedHTTPServer
(
socketserver
.
ThreadingMixIn
,
HTTPServer
):
daemon_threads
=
True
class
BaseHTTPRequestHandler
(
socketserver
.
StreamRequestHandler
):
class
BaseHTTPRequestHandler
(
socketserver
.
StreamRequestHandler
):
"""HTTP request handler base class.
"""HTTP request handler base class.
...
@@ -1213,7 +1217,8 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
...
@@ -1213,7 +1217,8 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
def
test
(
HandlerClass
=
BaseHTTPRequestHandler
,
def
test
(
HandlerClass
=
BaseHTTPRequestHandler
,
ServerClass
=
HTTPServer
,
protocol
=
"HTTP/1.0"
,
port
=
8000
,
bind
=
""
):
ServerClass
=
ThreadedHTTPServer
,
protocol
=
"HTTP/1.0"
,
port
=
8000
,
bind
=
""
):
"""Test the HTTP request handler class.
"""Test the HTTP request handler class.
This runs an HTTP server on port 8000 (or the port argument).
This runs an HTTP server on port 8000 (or the port argument).
...
...
Misc/NEWS.d/next/Library/2017-12-27-21-55-19.bpo-31639.l3avDJ.rst
0 → 100644
Dosyayı görüntüle @
8bcfa02e
http.server now exposes a ThreadedHTTPServer class and uses it when the
module is invoked to cope with web browsers pre-opening sockets.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment