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
9b78a714
Commit
9b78a714
authored
Jul 12, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change _begin() back to begin().
Client code could create responses explicitly.
parent
aa368c87
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
Lib/httplib.py
Lib/httplib.py
+2
-3
Lib/test/test_httplib.py
Lib/test/test_httplib.py
+3
-3
No files found.
Lib/httplib.py
View file @
9b78a714
...
@@ -199,7 +199,6 @@ class HTTPMessage(mimetools.Message):
...
@@ -199,7 +199,6 @@ class HTTPMessage(mimetools.Message):
self
.
status
=
self
.
status
+
'; bad seek'
self
.
status
=
self
.
status
+
'; bad seek'
break
break
class
HTTPResponse
:
class
HTTPResponse
:
# strict: If true, raise BadStatusLine if the status line can't be
# strict: If true, raise BadStatusLine if the status line can't be
...
@@ -260,7 +259,7 @@ class HTTPResponse:
...
@@ -260,7 +259,7 @@ class HTTPResponse:
raise
BadStatusLine
(
line
)
raise
BadStatusLine
(
line
)
return
version
,
status
,
reason
return
version
,
status
,
reason
def
_
begin
(
self
):
def
begin
(
self
):
if
self
.
msg
is
not
None
:
if
self
.
msg
is
not
None
:
# we've already started reading the response
# we've already started reading the response
return
return
...
@@ -741,7 +740,7 @@ class HTTPConnection:
...
@@ -741,7 +740,7 @@ class HTTPConnection:
else
:
else
:
response
=
self
.
response_class
(
self
.
sock
,
strict
=
self
.
strict
)
response
=
self
.
response_class
(
self
.
sock
,
strict
=
self
.
strict
)
response
.
_
begin
()
response
.
begin
()
assert
response
.
will_close
!=
_UNKNOWN
assert
response
.
will_close
!=
_UNKNOWN
self
.
__state
=
_CS_IDLE
self
.
__state
=
_CS_IDLE
...
...
Lib/test/test_httplib.py
View file @
9b78a714
...
@@ -16,7 +16,7 @@ class FakeSocket:
...
@@ -16,7 +16,7 @@ class FakeSocket:
body
=
"HTTP/1.1 200 Ok
\
r
\
n
\
r
\
n
Text"
body
=
"HTTP/1.1 200 Ok
\
r
\
n
\
r
\
n
Text"
sock
=
FakeSocket
(
body
)
sock
=
FakeSocket
(
body
)
resp
=
httplib
.
HTTPResponse
(
sock
,
1
)
resp
=
httplib
.
HTTPResponse
(
sock
,
1
)
resp
.
_
begin
()
resp
.
begin
()
print
resp
.
read
()
print
resp
.
read
()
resp
.
close
()
resp
.
close
()
...
@@ -24,7 +24,7 @@ body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText"
...
@@ -24,7 +24,7 @@ body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText"
sock
=
FakeSocket
(
body
)
sock
=
FakeSocket
(
body
)
resp
=
httplib
.
HTTPResponse
(
sock
,
1
)
resp
=
httplib
.
HTTPResponse
(
sock
,
1
)
try
:
try
:
resp
.
_
begin
()
resp
.
begin
()
except
httplib
.
BadStatusLine
:
except
httplib
.
BadStatusLine
:
print
"BadStatusLine raised as expected"
print
"BadStatusLine raised as expected"
else
:
else
:
...
@@ -52,7 +52,7 @@ hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"'
...
@@ -52,7 +52,7 @@ hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"'
'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"'
)
'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"'
)
s
=
FakeSocket
(
text
)
s
=
FakeSocket
(
text
)
r
=
httplib
.
HTTPResponse
(
s
,
1
)
r
=
httplib
.
HTTPResponse
(
s
,
1
)
r
.
_
begin
()
r
.
begin
()
cookies
=
r
.
getheader
(
"Set-Cookie"
)
cookies
=
r
.
getheader
(
"Set-Cookie"
)
if
cookies
!=
hdr
:
if
cookies
!=
hdr
:
raise
AssertionError
,
"multiple headers not combined properly"
raise
AssertionError
,
"multiple headers not combined properly"
...
...
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