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
239a0429
Kaydet (Commit)
239a0429
authored
Ock 04, 2012
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge from 3.2
üst
606e19dd
6497aa3e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
test_urllib2.py
Lib/test/test_urllib2.py
+13
-0
request.py
Lib/urllib/request.py
+2
-2
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_urllib2.py
Dosyayı görüntüle @
239a0429
...
...
@@ -1076,6 +1076,19 @@ class HandlerTests(unittest.TestCase):
MockHeaders
({
"location"
:
valid_url
}))
self
.
assertEqual
(
o
.
req
.
get_full_url
(),
valid_url
)
def
test_relative_redirect
(
self
):
from_url
=
"http://example.com/a.html"
relative_url
=
"/b.html"
h
=
urllib
.
request
.
HTTPRedirectHandler
()
o
=
h
.
parent
=
MockOpener
()
req
=
Request
(
from_url
)
req
.
timeout
=
socket
.
_GLOBAL_DEFAULT_TIMEOUT
valid_url
=
urllib
.
parse
.
urljoin
(
from_url
,
relative_url
)
h
.
http_error_302
(
req
,
MockFile
(),
302
,
"That's fine"
,
MockHeaders
({
"location"
:
valid_url
}))
self
.
assertEqual
(
o
.
req
.
get_full_url
(),
valid_url
)
def
test_cookie_redirect
(
self
):
# cookies shouldn't leak into redirected requests
from
http.cookiejar
import
CookieJar
...
...
Lib/urllib/request.py
Dosyayı görüntüle @
239a0429
...
...
@@ -572,7 +572,7 @@ class HTTPRedirectHandler(BaseHandler):
# For security reasons we don't allow redirection to anything other
# than http, https or ftp.
if
urlparts
.
scheme
not
in
(
'http'
,
'https'
,
'ftp'
):
if
urlparts
.
scheme
not
in
(
'http'
,
'https'
,
'ftp'
,
''
):
raise
HTTPError
(
newurl
,
code
,
"
%
s - Redirection to url '
%
s' is not allowed"
%
(
msg
,
newurl
),
...
...
@@ -1963,7 +1963,7 @@ class FancyURLopener(URLopener):
# We are using newer HTTPError with older redirect_internal method
# This older method will get deprecated in 3.3
if
urlparts
.
scheme
not
in
(
'http'
,
'https'
,
'ftp'
):
if
urlparts
.
scheme
not
in
(
'http'
,
'https'
,
'ftp'
,
''
):
raise
HTTPError
(
newurl
,
errcode
,
errmsg
+
" Redirection to url '
%
s' is not allowed."
%
newurl
,
...
...
Misc/NEWS
Dosyayı görüntüle @
239a0429
...
...
@@ -422,6 +422,8 @@ Core and Builtins
Library
-------
-
Issue
#
13696
:
Fix
the
302
Relative
URL
Redirection
problem
.
-
Issue
#
13636
:
Weak
ciphers
are
now
disabled
by
default
in
the
ssl
module
(
except
when
SSLv2
is
explicitly
asked
for
).
...
...
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