Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
80ba8e85
Commit
80ba8e85
authored
Sep 29, 2005
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug [ 1296004 ] MemoryError in httplib
parent
e677adc4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
Lib/httplib.py
Lib/httplib.py
+7
-4
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/httplib.py
View file @
80ba8e85
...
...
@@ -153,6 +153,9 @@ HTTP_VERSION_NOT_SUPPORTED = 505
INSUFFICIENT_STORAGE
=
507
NOT_EXTENDED
=
510
# maximal amount of data to read at one time in _safe_read
MAXAMOUNT
=
1048576
class
HTTPMessage
(
mimetools
.
Message
):
def
addheader
(
self
,
key
,
value
):
...
...
@@ -541,14 +544,14 @@ class HTTPResponse:
reading. If the bytes are truly not available (due to EOF), then the
IncompleteRead exception can be used to detect the problem.
"""
s
=
''
s
=
[]
while
amt
>
0
:
chunk
=
self
.
fp
.
read
(
amt
)
chunk
=
self
.
fp
.
read
(
min
(
amt
,
MAXAMOUNT
)
)
if
not
chunk
:
raise
IncompleteRead
(
s
)
s
+=
chunk
s
.
append
(
chunk
)
amt
-=
len
(
chunk
)
return
s
return
''
.
join
(
s
)
def
getheader
(
self
,
name
,
default
=
None
):
if
self
.
msg
is
None
:
...
...
Misc/NEWS
View file @
80ba8e85
...
...
@@ -242,6 +242,9 @@ Extension Modules
Library
-------
-
Bug
#
1296004
:
httplib
.
py
:
Limit
maximal
amount
of
data
read
from
the
socket
to
avoid
a
MemoryError
on
Windows
.
-
Patch
#
1166948
:
locale
.
py
:
Prefer
LC_ALL
,
LC_CTYPE
and
LANG
over
LANGUAGE
to
get
the
correct
encoding
.
...
...
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