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
230393e5
Kaydet (Commit)
230393e5
authored
Agu 15, 2014
tarafından
Collin Anderson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23295 -- Removed unnecessary fix_location_header request.get_host() check.
üst
7ca665c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
utils.py
django/http/utils.py
+1
-1
tests.py
tests/http_utils/tests.py
+13
-2
No files found.
django/http/utils.py
Dosyayı görüntüle @
230393e5
...
@@ -17,7 +17,7 @@ def fix_location_header(request, response):
...
@@ -17,7 +17,7 @@ def fix_location_header(request, response):
Code constructing response objects is free to insert relative paths, as
Code constructing response objects is free to insert relative paths, as
this function converts them to absolute paths.
this function converts them to absolute paths.
"""
"""
if
'Location'
in
response
and
request
.
get_host
()
:
if
'Location'
in
response
:
response
[
'Location'
]
=
request
.
build_absolute_uri
(
response
[
'Location'
])
response
[
'Location'
]
=
request
.
build_absolute_uri
(
response
[
'Location'
])
return
response
return
response
...
...
tests/http_utils/tests.py
Dosyayı görüntüle @
230393e5
...
@@ -3,8 +3,8 @@ from __future__ import unicode_literals
...
@@ -3,8 +3,8 @@ from __future__ import unicode_literals
import
io
import
io
import
gzip
import
gzip
from
django.http
import
HttpRequest
,
HttpResponse
,
StreamingHttpResponse
from
django.http
import
HttpRequest
,
HttpResponse
,
HttpResponseRedirect
,
StreamingHttpResponse
from
django.http.utils
import
conditional_content_removal
from
django.http.utils
import
conditional_content_removal
,
fix_location_header
from
django.test
import
TestCase
from
django.test
import
TestCase
...
@@ -69,3 +69,14 @@ class HttpUtilTests(TestCase):
...
@@ -69,3 +69,14 @@ class HttpUtilTests(TestCase):
res
=
StreamingHttpResponse
([
'abc'
])
res
=
StreamingHttpResponse
([
'abc'
])
conditional_content_removal
(
req
,
res
)
conditional_content_removal
(
req
,
res
)
self
.
assertEqual
(
b
''
.
join
(
res
),
b
''
)
self
.
assertEqual
(
b
''
.
join
(
res
),
b
''
)
def
test_fix_location_without_get_host
(
self
):
"""
Tests that you can return an absolute redirect when the request
host is not in ALLOWED_HOSTS. Issue #20472
"""
request
=
HttpRequest
()
def
bomb
():
self
.
assertTrue
(
False
)
request
.
get_host
=
bomb
fix_location_header
(
request
,
HttpResponseRedirect
(
'http://example.com'
))
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