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
433433fa
Unverified
Kaydet (Commit)
433433fa
authored
Kas 26, 2018
tarafından
Lisa Roach
Kaydeden (comit)
GitHub
Kas 26, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Adds IPv6 support when invoking http.server directly. (GH-10595)
üst
75e4699b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
2 deletions
+30
-2
http.server.rst
Doc/library/http.server.rst
+6
-2
server.py
Lib/http/server.py
+3
-0
test_httpservers.py
Lib/test/test_httpservers.py
+20
-0
2018-11-18-18-44-40.bpo-24209.p3YWOf.rst
...S.d/next/Library/2018-11-18-18-44-40.bpo-24209.p3YWOf.rst
+1
-0
No files found.
Doc/library/http.server.rst
Dosyayı görüntüle @
433433fa
...
...
@@ -410,14 +410,18 @@ the previous example, this serves files relative to the current directory::
python -m http.server 8000
By default, server binds itself to all interfaces. The option ``-b/--bind``
specifies a specific address to which it should bind. For example, the
following command causes the server to bind to localhost only::
specifies a specific address to which it should bind. Both IPv4 and IPv6
addresses are supported. For example, the following command causes the server
to bind to localhost only::
python -m http.server 8000 --bind 127.0.0.1
.. versionadded:: 3.4
``--bind`` argument was introduced.
.. versionadded:: 3.8
``--bind`` argument enhanced to support IPv6
By default, server uses the current directory. The option ``-d/--directory``
specifies a directory to which it should serve the files. For example,
the following command uses a specific directory::
...
...
Lib/http/server.py
Dosyayı görüntüle @
433433fa
...
...
@@ -1226,6 +1226,9 @@ def test(HandlerClass=BaseHTTPRequestHandler,
"""
server_address
=
(
bind
,
port
)
if
':'
in
bind
:
ServerClass
.
address_family
=
socket
.
AF_INET6
HandlerClass
.
protocol_version
=
protocol
with
ServerClass
(
server_address
,
HandlerClass
)
as
httpd
:
sa
=
httpd
.
socket
.
getsockname
()
...
...
Lib/test/test_httpservers.py
Dosyayı görüntüle @
433433fa
...
...
@@ -9,6 +9,7 @@ from http.server import BaseHTTPRequestHandler, HTTPServer, \
from
http
import
server
,
HTTPStatus
import
os
import
socket
import
sys
import
re
import
base64
...
...
@@ -1116,6 +1117,24 @@ class MiscTestCase(unittest.TestCase):
self
.
assertCountEqual
(
server
.
__all__
,
expected
)
class
ScriptTestCase
(
unittest
.
TestCase
):
@mock.patch
(
'builtins.print'
)
def
test_server_test_ipv6
(
self
,
_
):
mock_server
=
mock
.
MagicMock
()
server
.
test
(
ServerClass
=
mock_server
,
bind
=
"::"
)
self
.
assertEqual
(
mock_server
.
address_family
,
socket
.
AF_INET6
)
mock_server
.
reset_mock
()
server
.
test
(
ServerClass
=
mock_server
,
bind
=
"2001:0db8:85a3:0000:0000:8a2e:0370:7334"
)
self
.
assertEqual
(
mock_server
.
address_family
,
socket
.
AF_INET6
)
mock_server
.
reset_mock
()
server
.
test
(
ServerClass
=
mock_server
,
bind
=
"::1"
)
self
.
assertEqual
(
mock_server
.
address_family
,
socket
.
AF_INET6
)
def
test_main
(
verbose
=
None
):
cwd
=
os
.
getcwd
()
try
:
...
...
@@ -1127,6 +1146,7 @@ def test_main(verbose=None):
CGIHTTPServerTestCase
,
SimpleHTTPRequestHandlerTestCase
,
MiscTestCase
,
ScriptTestCase
)
finally
:
os
.
chdir
(
cwd
)
...
...
Misc/NEWS.d/next/Library/2018-11-18-18-44-40.bpo-24209.p3YWOf.rst
0 → 100644
Dosyayı görüntüle @
433433fa
Adds IPv6 support when invoking http.server directly.
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