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
7c2867fc
Kaydet (Commit)
7c2867fc
authored
Nis 21, 2009
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix for the Issue918368 - urllib doesn't correct server returned urls
üst
a7e734fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
test_urllib.py
Lib/test/test_urllib.py
+13
-0
urllib.py
Lib/urllib.py
+3
-0
No files found.
Lib/test/test_urllib.py
Dosyayı görüntüle @
7c2867fc
...
@@ -598,6 +598,18 @@ class Utility_Tests(unittest.TestCase):
...
@@ -598,6 +598,18 @@ class Utility_Tests(unittest.TestCase):
self
.
assertEqual
((
'user'
,
'a:b'
),
urllib
.
splitpasswd
(
'user:a:b'
))
self
.
assertEqual
((
'user'
,
'a:b'
),
urllib
.
splitpasswd
(
'user:a:b'
))
class
URLopener_Tests
(
unittest
.
TestCase
):
"""Testcase to test the open method of URLopener class."""
def
test_quoted_open
(
self
):
class
DummyURLopener
(
urllib
.
URLopener
):
def
open_spam
(
self
,
url
):
return
url
self
.
assertEqual
(
DummyURLopener
()
.
open
(
'spam://example/ /'
),
'//example/
%20
/'
)
# Just commented them out.
# Just commented them out.
# Can't really tell why keep failing in windows and sparc.
# Can't really tell why keep failing in windows and sparc.
# Everywhere else they work ok, but on those machines, someteimes
# Everywhere else they work ok, but on those machines, someteimes
...
@@ -693,6 +705,7 @@ def test_main():
...
@@ -693,6 +705,7 @@ def test_main():
urlencode_Tests
,
urlencode_Tests
,
Pathname_Tests
,
Pathname_Tests
,
Utility_Tests
,
Utility_Tests
,
URLopener_Tests
,
#FTPWrapperTests,
#FTPWrapperTests,
)
)
...
...
Lib/urllib.py
Dosyayı görüntüle @
7c2867fc
...
@@ -176,6 +176,9 @@ class URLopener:
...
@@ -176,6 +176,9 @@ class URLopener:
def
open
(
self
,
fullurl
,
data
=
None
):
def
open
(
self
,
fullurl
,
data
=
None
):
"""Use URLopener().open(file) instead of open(file, 'r')."""
"""Use URLopener().open(file) instead of open(file, 'r')."""
fullurl
=
unwrap
(
toBytes
(
fullurl
))
fullurl
=
unwrap
(
toBytes
(
fullurl
))
# percent encode url, fixing lame server errors for e.g, like space
# within url paths.
fullurl
=
quote
(
fullurl
,
safe
=
"
%
/:=&?~#+!$,;'@()*[]"
)
if
self
.
tempcache
and
fullurl
in
self
.
tempcache
:
if
self
.
tempcache
and
fullurl
in
self
.
tempcache
:
filename
,
headers
=
self
.
tempcache
[
fullurl
]
filename
,
headers
=
self
.
tempcache
[
fullurl
]
fp
=
open
(
filename
,
'rb'
)
fp
=
open
(
filename
,
'rb'
)
...
...
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