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
98eb6c28
Commit
98eb6c28
authored
Mar 27, 2009
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compatibility issue with HTTPMessage class.
The server needs to use MessageClass to parse.
parent
914ab45d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
Lib/http/client.py
Lib/http/client.py
+2
-3
Lib/http/server.py
Lib/http/server.py
+2
-1
No files found.
Lib/http/client.py
View file @
98eb6c28
...
...
@@ -213,7 +213,6 @@ class HTTPMessage(email.message.Message):
occurrences are returned. Case is not important in the header name.
"""
# XXX: copied from rfc822.Message for compatibility
name
=
name
.
lower
()
+
':'
n
=
len
(
name
)
lst
=
[]
...
...
@@ -227,7 +226,7 @@ class HTTPMessage(email.message.Message):
lst
.
append
(
line
)
return
lst
def
parse_headers
(
fp
):
def
parse_headers
(
fp
,
_class
=
HTTPMessage
):
"""Parses only RFC2822 headers from a file pointer.
email Parser wants to see strings rather than bytes.
...
...
@@ -245,7 +244,7 @@ def parse_headers(fp):
break
hstring
=
b''
.
join
(
headers
).
decode
(
'iso-8859-1'
)
return
email
.
parser
.
Parser
(
_class
=
HTTPMessage
).
parsestr
(
hstring
)
return
email
.
parser
.
Parser
(
_class
=
_class
).
parsestr
(
hstring
)
class
HTTPResponse
(
io
.
RawIOBase
):
...
...
Lib/http/server.py
View file @
98eb6c28
...
...
@@ -313,7 +313,8 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
self
.
command
,
self
.
path
,
self
.
request_version
=
command
,
path
,
version
# Examine the headers and look for a Connection directive.
self
.
headers
=
http
.
client
.
parse_headers
(
self
.
rfile
)
self
.
headers
=
http
.
client
.
parse_headers
(
self
.
rfile
,
_class
=
self
.
MessageClass
)
conntype
=
self
.
headers
.
get
(
'Connection'
,
""
)
if
conntype
.
lower
()
==
'close'
:
...
...
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