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
1e81a4b8
Kaydet (Commit)
1e81a4b8
authored
Ock 11, 2018
tarafından
Jon Dufresne
Kaydeden (comit)
Tim Graham
Ock 11, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #28638 -- Made allowed_hosts a required argument of is_safe_url().
üst
1dce629c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
http.py
django/utils/http.py
+1
-1
2.1.txt
docs/releases/2.1.txt
+3
-0
test_http.py
tests/utils_tests/test_http.py
+2
-2
No files found.
django/utils/http.py
Dosyayı görüntüle @
1e81a4b8
...
@@ -282,7 +282,7 @@ def is_same_domain(host, pattern):
...
@@ -282,7 +282,7 @@ def is_same_domain(host, pattern):
)
)
def
is_safe_url
(
url
,
allowed_hosts
=
None
,
require_https
=
False
):
def
is_safe_url
(
url
,
allowed_hosts
,
require_https
=
False
):
"""
"""
Return ``True`` if the url is a safe redirection (i.e. it doesn't point to
Return ``True`` if the url is a safe redirection (i.e. it doesn't point to
a different host and uses a safe scheme).
a different host and uses a safe scheme).
...
...
docs/releases/2.1.txt
Dosyayı görüntüle @
1e81a4b8
...
@@ -245,6 +245,9 @@ Miscellaneous
...
@@ -245,6 +245,9 @@ Miscellaneous
This change should be merely cosmetic except perhaps for antiquated browsers
This change should be merely cosmetic except perhaps for antiquated browsers
that don't parse the new format.
that don't parse the new format.
* ``allowed_hosts`` is now a required argument of private API
``django.utils.http.is_safe_url()``.
.. _deprecated-features-2.1:
.. _deprecated-features-2.1:
Features deprecated in 2.1
Features deprecated in 2.1
...
...
tests/utils_tests/test_http.py
Dosyayı görüntüle @
1e81a4b8
...
@@ -161,9 +161,9 @@ class IsSafeURLTests(unittest.TestCase):
...
@@ -161,9 +161,9 @@ class IsSafeURLTests(unittest.TestCase):
def
test_no_allowed_hosts
(
self
):
def
test_no_allowed_hosts
(
self
):
# A path without host is allowed.
# A path without host is allowed.
self
.
assertIs
(
is_safe_url
(
'/confirm/me@example.com'
),
True
)
self
.
assertIs
(
is_safe_url
(
'/confirm/me@example.com'
,
allowed_hosts
=
None
),
True
)
# Basic auth without host is not allowed.
# Basic auth without host is not allowed.
self
.
assertIs
(
is_safe_url
(
r'http://testserver\@example.com'
),
False
)
self
.
assertIs
(
is_safe_url
(
r'http://testserver\@example.com'
,
allowed_hosts
=
None
),
False
)
def
test_secure_param_https_urls
(
self
):
def
test_secure_param_https_urls
(
self
):
secure_urls
=
(
secure_urls
=
(
...
...
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