Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
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
django
Commits
e6065c7b
Kaydet (Commit)
e6065c7b
authored
Eki 30, 2015
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25619 -- Made runserver serve with HTTP 1.1 protocol
Thanks Tim Graham for the review.
üst
007d4e03
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
3 deletions
+29
-3
basehttp.py
django/core/servers/basehttp.py
+12
-2
2.0.txt
docs/releases/2.0.txt
+1
-1
tests.py
tests/servers/tests.py
+16
-0
No files found.
django/core/servers/basehttp.py
Dosyayı görüntüle @
e6065c7b
...
...
@@ -78,6 +78,8 @@ class ThreadedWSGIServer(socketserver.ThreadingMixIn, WSGIServer):
class
ServerHandler
(
simple_server
.
ServerHandler
):
http_version
=
'1.1'
def
handle_error
(
self
):
# Ignore broken pipe errors, otherwise pass on
if
not
is_broken_pipe_error
():
...
...
@@ -85,6 +87,8 @@ class ServerHandler(simple_server.ServerHandler):
class
WSGIRequestHandler
(
simple_server
.
WSGIRequestHandler
):
protocol_version
=
'HTTP/1.1'
def
address_string
(
self
):
# Short-circuit parent method to not call socket.getfqdn
return
self
.
client_address
[
0
]
...
...
@@ -131,8 +135,14 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler):
return
super
()
.
get_environ
()
def
handle
(
self
):
"""Copy of WSGIRequestHandler, but with different ServerHandler"""
"""Handle multiple requests if necessary."""
self
.
close_connection
=
1
self
.
handle_one_request
()
while
not
self
.
close_connection
:
self
.
handle_one_request
()
def
handle_one_request
(
self
):
"""Copy of WSGIRequestHandler.handle() but with different ServerHandler"""
self
.
raw_requestline
=
self
.
rfile
.
readline
(
65537
)
if
len
(
self
.
raw_requestline
)
>
65536
:
self
.
requestline
=
''
...
...
docs/releases/2.0.txt
Dosyayı görüntüle @
e6065c7b
...
...
@@ -173,7 +173,7 @@ Models
Requests and Responses
~~~~~~~~~~~~~~~~~~~~~~
*
..
.
*
The :djadmin:`runserver` Web server supports HTTP 1.1
.
Serialization
~~~~~~~~~~~~~
...
...
tests/servers/tests.py
Dosyayı görüntüle @
e6065c7b
...
...
@@ -4,11 +4,13 @@ Tests for django.core.servers.
import
errno
import
os
import
socket
from
http.client
import
HTTPConnection
from
urllib.error
import
HTTPError
from
urllib.parse
import
urlencode
from
urllib.request
import
urlopen
from
django.test
import
LiveServerTestCase
,
override_settings
from
django.test.utils
import
captured_stdout
from
.models
import
Person
...
...
@@ -50,6 +52,20 @@ class LiveServerAddress(LiveServerBase):
class
LiveServerViews
(
LiveServerBase
):
def
test_protocol
(
self
):
"""Launched server serves with HTTP 1.1."""
with
captured_stdout
()
as
debug_output
:
conn
=
HTTPConnection
(
LiveServerViews
.
server_thread
.
host
,
LiveServerViews
.
server_thread
.
port
)
try
:
conn
.
set_debuglevel
(
1
)
conn
.
request
(
'GET'
,
'/example_view/'
,
headers
=
{
"Connection"
:
"keep-alive"
})
conn
.
getresponse
()
.
read
()
conn
.
request
(
'GET'
,
'/example_view/'
,
headers
=
{
"Connection"
:
"close"
})
conn
.
getresponse
()
finally
:
conn
.
close
()
self
.
assertEqual
(
debug_output
.
getvalue
()
.
count
(
"reply: 'HTTP/1.1 200 OK"
),
2
)
def
test_404
(
self
):
with
self
.
assertRaises
(
HTTPError
)
as
err
:
self
.
urlopen
(
'/'
)
...
...
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