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
91b0bc23
Kaydet (Commit)
91b0bc23
authored
Ock 25, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #20331: Fixed possible FD leaks in various modules:
http.server, imghdr, mailcap, mimetypes, xml.etree.
üst
93320968
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
8 deletions
+12
-8
server.py
Lib/http/server.py
+6
-0
imghdr.py
Lib/imghdr.py
+2
-4
mailcap.py
Lib/mailcap.py
+1
-1
mimetypes.py
Lib/mimetypes.py
+1
-0
ElementInclude.py
Lib/xml/etree/ElementInclude.py
+2
-3
No files found.
Lib/http/server.py
Dosyayı görüntüle @
91b0bc23
...
@@ -670,7 +670,9 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
...
@@ -670,7 +670,9 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
"""Serve a GET request."""
"""Serve a GET request."""
f
=
self
.
send_head
()
f
=
self
.
send_head
()
if
f
:
if
f
:
try
:
self
.
copyfile
(
f
,
self
.
wfile
)
self
.
copyfile
(
f
,
self
.
wfile
)
finally
:
f
.
close
()
f
.
close
()
def
do_HEAD
(
self
):
def
do_HEAD
(
self
):
...
@@ -712,6 +714,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
...
@@ -712,6 +714,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
except
IOError
:
except
IOError
:
self
.
send_error
(
404
,
"File not found"
)
self
.
send_error
(
404
,
"File not found"
)
return
None
return
None
try
:
self
.
send_response
(
200
)
self
.
send_response
(
200
)
self
.
send_header
(
"Content-type"
,
ctype
)
self
.
send_header
(
"Content-type"
,
ctype
)
fs
=
os
.
fstat
(
f
.
fileno
())
fs
=
os
.
fstat
(
f
.
fileno
())
...
@@ -719,6 +722,9 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
...
@@ -719,6 +722,9 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
self
.
send_header
(
"Last-Modified"
,
self
.
date_time_string
(
fs
.
st_mtime
))
self
.
send_header
(
"Last-Modified"
,
self
.
date_time_string
(
fs
.
st_mtime
))
self
.
end_headers
()
self
.
end_headers
()
return
f
return
f
except
:
f
.
close
()
raise
def
list_directory
(
self
,
path
):
def
list_directory
(
self
,
path
):
"""Helper to produce a directory listing (absent index.html).
"""Helper to produce a directory listing (absent index.html).
...
...
Lib/imghdr.py
Dosyayı görüntüle @
91b0bc23
...
@@ -7,6 +7,8 @@ __all__ = ["what"]
...
@@ -7,6 +7,8 @@ __all__ = ["what"]
#-------------------------#
#-------------------------#
def
what
(
file
,
h
=
None
):
def
what
(
file
,
h
=
None
):
f
=
None
try
:
if
h
is
None
:
if
h
is
None
:
if
isinstance
(
file
,
str
):
if
isinstance
(
file
,
str
):
f
=
open
(
file
,
'rb'
)
f
=
open
(
file
,
'rb'
)
...
@@ -15,10 +17,6 @@ def what(file, h=None):
...
@@ -15,10 +17,6 @@ def what(file, h=None):
location
=
file
.
tell
()
location
=
file
.
tell
()
h
=
file
.
read
(
32
)
h
=
file
.
read
(
32
)
file
.
seek
(
location
)
file
.
seek
(
location
)
f
=
None
else
:
f
=
None
try
:
for
tf
in
tests
:
for
tf
in
tests
:
res
=
tf
(
h
,
f
)
res
=
tf
(
h
,
f
)
if
res
:
if
res
:
...
...
Lib/mailcap.py
Dosyayı görüntüle @
91b0bc23
...
@@ -22,8 +22,8 @@ def getcaps():
...
@@ -22,8 +22,8 @@ def getcaps():
fp
=
open
(
mailcap
,
'r'
)
fp
=
open
(
mailcap
,
'r'
)
except
IOError
:
except
IOError
:
continue
continue
with
fp
:
morecaps
=
readmailcapfile
(
fp
)
morecaps
=
readmailcapfile
(
fp
)
fp
.
close
()
for
key
,
value
in
morecaps
.
items
():
for
key
,
value
in
morecaps
.
items
():
if
not
key
in
caps
:
if
not
key
in
caps
:
caps
[
key
]
=
value
caps
[
key
]
=
value
...
...
Lib/mimetypes.py
Dosyayı görüntüle @
91b0bc23
...
@@ -363,6 +363,7 @@ def read_mime_types(file):
...
@@ -363,6 +363,7 @@ def read_mime_types(file):
f
=
open
(
file
)
f
=
open
(
file
)
except
IOError
:
except
IOError
:
return
None
return
None
with
f
:
db
=
MimeTypes
()
db
=
MimeTypes
()
db
.
readfp
(
f
,
True
)
db
.
readfp
(
f
,
True
)
return
db
.
types_map
[
True
]
return
db
.
types_map
[
True
]
...
...
Lib/xml/etree/ElementInclude.py
Dosyayı görüntüle @
91b0bc23
...
@@ -76,14 +76,13 @@ class FatalIncludeError(SyntaxError):
...
@@ -76,14 +76,13 @@ class FatalIncludeError(SyntaxError):
def
default_loader
(
href
,
parse
,
encoding
=
None
):
def
default_loader
(
href
,
parse
,
encoding
=
None
):
if
parse
==
"xml"
:
if
parse
==
"xml"
:
file
=
open
(
href
,
'rb'
)
with
open
(
href
,
'rb'
)
as
file
:
data
=
ElementTree
.
parse
(
file
)
.
getroot
()
data
=
ElementTree
.
parse
(
file
)
.
getroot
()
else
:
else
:
if
not
encoding
:
if
not
encoding
:
encoding
=
'UTF-8'
encoding
=
'UTF-8'
file
=
open
(
href
,
'r'
,
encoding
=
encoding
)
with
open
(
href
,
'r'
,
encoding
=
encoding
)
as
file
:
data
=
file
.
read
()
data
=
file
.
read
()
file
.
close
()
return
data
return
data
##
##
...
...
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