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
6e132254
Commit
6e132254
authored
Feb 25, 2016
by
Martin Panter
Browse files
Options
Browse Files
Download
Plain Diff
Issue #26402: Merge XML-RPC client fix from 3.5
parents
f799ca82
eae3336e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
3 deletions
+44
-3
Lib/test/test_xmlrpc.py
Lib/test/test_xmlrpc.py
+37
-0
Lib/xmlrpc/client.py
Lib/xmlrpc/client.py
+3
-3
Misc/NEWS
Misc/NEWS
+4
-0
No files found.
Lib/test/test_xmlrpc.py
View file @
6e132254
...
@@ -7,6 +7,7 @@ from unittest import mock
...
@@ -7,6 +7,7 @@ from unittest import mock
import
xmlrpc.client
as
xmlrpclib
import
xmlrpc.client
as
xmlrpclib
import
xmlrpc.server
import
xmlrpc.server
import
http.client
import
http.client
import
http
,
http
.
server
import
socket
import
socket
import
os
import
os
import
re
import
re
...
@@ -244,6 +245,42 @@ class XMLRPCTestCase(unittest.TestCase):
...
@@ -244,6 +245,42 @@ class XMLRPCTestCase(unittest.TestCase):
except
OSError
:
except
OSError
:
self
.
assertTrue
(
has_ssl
)
self
.
assertTrue
(
has_ssl
)
@
unittest
.
skipUnless
(
threading
,
"Threading required for this test."
)
def
test_keepalive_disconnect
(
self
):
class
RequestHandler
(
http
.
server
.
BaseHTTPRequestHandler
):
protocol_version
=
"HTTP/1.1"
handled
=
False
def
do_POST
(
self
):
length
=
int
(
self
.
headers
.
get
(
"Content-Length"
))
self
.
rfile
.
read
(
length
)
if
self
.
handled
:
self
.
close_connection
=
True
return
response
=
xmlrpclib
.
dumps
((
5
,),
methodresponse
=
True
)
response
=
response
.
encode
()
self
.
send_response
(
http
.
HTTPStatus
.
OK
)
self
.
send_header
(
"Content-Length"
,
len
(
response
))
self
.
end_headers
()
self
.
wfile
.
write
(
response
)
self
.
handled
=
True
self
.
close_connection
=
False
def
run_server
():
server
.
socket
.
settimeout
(
float
(
1
))
# Don't hang if client fails
server
.
handle_request
()
# First request and attempt at second
server
.
handle_request
()
# Retried second request
server
=
http
.
server
.
HTTPServer
((
support
.
HOST
,
0
),
RequestHandler
)
self
.
addCleanup
(
server
.
server_close
)
thread
=
threading
.
Thread
(
target
=
run_server
)
thread
.
start
()
self
.
addCleanup
(
thread
.
join
)
url
=
"http://{}:{}/"
.
format
(
*
server
.
server_address
)
with
xmlrpclib
.
ServerProxy
(
url
)
as
p
:
self
.
assertEqual
(
p
.
method
(),
5
)
self
.
assertEqual
(
p
.
method
(),
5
)
class
HelperTestCase
(
unittest
.
TestCase
):
class
HelperTestCase
(
unittest
.
TestCase
):
def
test_escape
(
self
):
def
test_escape
(
self
):
self
.
assertEqual
(
xmlrpclib
.
escape
(
"a&b"
),
"a&b"
)
self
.
assertEqual
(
xmlrpclib
.
escape
(
"a&b"
),
"a&b"
)
...
...
Lib/xmlrpc/client.py
View file @
6e132254
...
@@ -1129,13 +1129,13 @@ class Transport:
...
@@ -1129,13 +1129,13 @@ class Transport:
for
i
in
(
0
,
1
):
for
i
in
(
0
,
1
):
try
:
try
:
return
self
.
single_request
(
host
,
handler
,
request_body
,
verbose
)
return
self
.
single_request
(
host
,
handler
,
request_body
,
verbose
)
except
http
.
client
.
RemoteDisconnected
:
if
i
:
raise
except
OSError
as
e
:
except
OSError
as
e
:
if
i
or
e
.
errno
not
in
(
errno
.
ECONNRESET
,
errno
.
ECONNABORTED
,
if
i
or
e
.
errno
not
in
(
errno
.
ECONNRESET
,
errno
.
ECONNABORTED
,
errno
.
EPIPE
):
errno
.
EPIPE
):
raise
raise
except
http
.
client
.
RemoteDisconnected
:
if
i
:
raise
def
single_request
(
self
,
host
,
handler
,
request_body
,
verbose
=
False
):
def
single_request
(
self
,
host
,
handler
,
request_body
,
verbose
=
False
):
# issue XML-RPC request
# issue XML-RPC request
...
...
Misc/NEWS
View file @
6e132254
...
@@ -189,6 +189,10 @@ Core and Builtins
...
@@ -189,6 +189,10 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
26402
:
Fix
XML
-
RPC
client
to
retry
when
the
server
shuts
down
a
persistent
connection
.
This
was
a
regression
related
to
the
new
http
.
client
.
RemoteDisconnected
exception
in
3.5.0
a4
.
-
Issue
#
25913
:
Leading
``<~``
is
optional
now
in
base64
.
a85decode
()
with
-
Issue
#
25913
:
Leading
``<~``
is
optional
now
in
base64
.
a85decode
()
with
adobe
=
True
.
Patch
by
Swati
Jaiswal
.
adobe
=
True
.
Patch
by
Swati
Jaiswal
.
...
...
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