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
18e4dd74
Kaydet (Commit)
18e4dd74
authored
May 08, 2010
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixing the errors trigerred in test_urllib2net. Related to issue8656.
üst
6057ba1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
urllib2.py
Lib/urllib2.py
+8
-5
No files found.
Lib/urllib2.py
Dosyayı görüntüle @
18e4dd74
...
...
@@ -1276,13 +1276,13 @@ class FileHandler(BaseHandler):
import
email.utils
import
mimetypes
host
=
req
.
get_host
()
file
=
req
.
get_selector
()
localfile
=
url2pathname
(
file
)
file
name
=
req
.
get_selector
()
localfile
=
url2pathname
(
file
name
)
try
:
stats
=
os
.
stat
(
localfile
)
size
=
stats
.
st_size
modified
=
email
.
utils
.
formatdate
(
stats
.
st_mtime
,
usegmt
=
True
)
mtype
=
mimetypes
.
guess_type
(
file
)[
0
]
mtype
=
mimetypes
.
guess_type
(
file
name
)[
0
]
headers
=
mimetools
.
Message
(
StringIO
(
'Content-type:
%
s
\n
Content-length:
%
d
\n
Last-modified:
%
s
\n
'
%
(
mtype
or
'text/plain'
,
size
,
modified
)))
...
...
@@ -1290,8 +1290,11 @@ class FileHandler(BaseHandler):
host
,
port
=
splitport
(
host
)
if
not
host
or
\
(
not
port
and
socket
.
gethostbyname
(
host
)
in
self
.
get_names
()):
return
addinfourl
(
open
(
localfile
,
'rb'
),
headers
,
'file://'
+
host
+
file
)
if
host
:
origurl
=
'file://'
+
host
+
filename
else
:
origurl
=
'file://'
+
filename
return
addinfourl
(
open
(
localfile
,
'rb'
),
headers
,
origurl
)
except
OSError
,
msg
:
# urllib2 users shouldn't expect OSErrors coming from urlopen()
raise
URLError
(
msg
)
...
...
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