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
61f9243e
Kaydet (Commit)
61f9243e
authored
Eki 14, 2016
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27345 -- Stopped setting the Date header in ConditionalGetMiddleware.
üst
b679a3cd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
12 deletions
+8
-12
http.py
django/middleware/http.py
+2
-3
middleware.txt
docs/ref/middleware.txt
+3
-2
1.11.txt
docs/releases/1.11.txt
+3
-0
tests.py
tests/middleware/tests.py
+0
-7
No files found.
django/middleware/http.py
Dosyayı görüntüle @
61f9243e
...
...
@@ -2,7 +2,7 @@ from django.utils.cache import (
cc_delim_re
,
get_conditional_response
,
set_response_etag
,
)
from
django.utils.deprecation
import
MiddlewareMixin
from
django.utils.http
import
http_date
,
parse_http_date_safe
from
django.utils.http
import
parse_http_date_safe
class
ConditionalGetMiddleware
(
MiddlewareMixin
):
...
...
@@ -12,10 +12,9 @@ class ConditionalGetMiddleware(MiddlewareMixin):
If-Modified-Since, the response is replaced by an HttpNotModified. An ETag
header is added if needed.
Also sets the
Date and Content-Length response-headers
.
Also sets the
Content-Length response-header
.
"""
def
process_response
(
self
,
request
,
response
):
response
[
'Date'
]
=
http_date
()
if
not
response
.
streaming
and
not
response
.
has_header
(
'Content-Length'
):
response
[
'Content-Length'
]
=
str
(
len
(
response
.
content
))
...
...
docs/ref/middleware.txt
Dosyayı görüntüle @
61f9243e
...
...
@@ -181,11 +181,12 @@ header, the middleware adds one if needed. If the response has a ``ETag`` or
``If-Modified-Since``, the response is replaced by an
:class:`~django.http.HttpResponseNotModified`.
Also sets
the ``Date`` and ``Content-Length`` response-headers
.
Also sets
``Content-Length`` response-header
.
.. versionchanged:: 1.11
In older versions, the middleware didn't set the ``ETag`` header.
In older versions, the middleware set the ``Date`` header and didn't set
the ``ETag`` header.
Locale middleware
-----------------
...
...
docs/releases/1.11.txt
Dosyayı görüntüle @
61f9243e
...
...
@@ -559,6 +559,9 @@ Miscellaneous
* In the admin templates, ``<p class="help">`` is replaced with a ``<div>`` tag
to allow including lists inside help text.
* ``ConditionalGetMiddleware`` no longer sets the ``Date`` header as Web
servers set that header.
.. _deprecated-features-1.11:
Features deprecated in 1.11
...
...
tests/middleware/tests.py
Dosyayı görüntüle @
61f9243e
...
...
@@ -478,13 +478,6 @@ class ConditionalGetMiddlewareTest(SimpleTestCase):
self
.
req
=
RequestFactory
()
.
get
(
'/'
)
self
.
resp
=
self
.
client
.
get
(
self
.
req
.
path_info
)
# Tests for the Date header
def
test_date_header_added
(
self
):
self
.
assertNotIn
(
'Date'
,
self
.
resp
)
self
.
resp
=
ConditionalGetMiddleware
()
.
process_response
(
self
.
req
,
self
.
resp
)
self
.
assertIn
(
'Date'
,
self
.
resp
)
# Tests for the Content-Length header
def
test_content_length_header_added
(
self
):
...
...
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