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
75861df9
Commit
75861df9
authored
Oct 30, 2011
by
Florent Xicluna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix User-Agent for the xmlrpc.client, and catch KeyboardInterrupt for the standalone xmlrpc.server.
parent
2b6403e5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
Lib/xmlrpc/client.py
Lib/xmlrpc/client.py
+4
-3
Lib/xmlrpc/server.py
Lib/xmlrpc/server.py
+7
-2
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/xmlrpc/client.py
View file @
75861df9
...
...
@@ -128,6 +128,7 @@ Exported functions:
"""
import
base64
import
sys
import
time
import
http.client
from
xml.parsers
import
expat
...
...
@@ -152,7 +153,8 @@ def escape(s):
s
=
s
.
replace
(
"<"
,
"<"
)
return
s
.
replace
(
">"
,
">"
,)
__version__
=
"1.0.1"
# used in User-Agent header sent
__version__
=
sys
.
version
[:
3
]
# xmlrpc integer limits
MAXINT
=
2
**
31
-
1
...
...
@@ -408,7 +410,6 @@ class Binary:
out
.
write
(
"<value><base64>
\
n
"
)
encoded
=
base64
.
encodebytes
(
self
.
data
)
out
.
write
(
encoded
.
decode
(
'ascii'
))
out
.
write
(
'
\
n
'
)
out
.
write
(
"</base64></value>
\
n
"
)
def
_binary
(
data
):
...
...
@@ -1079,7 +1080,7 @@ class Transport:
"""Handles an HTTP transaction to an XML-RPC server."""
# client identifier (may be overridden)
user_agent
=
"
xmlrpclib.py/%s (by www.pythonware.com)
"
%
__version__
user_agent
=
"
Python-xmlrpc/%s
"
%
__version__
#if true, we'll request gzip encoding
accept_gzip_encoding
=
True
...
...
Lib/xmlrpc/server.py
View file @
75861df9
...
...
@@ -956,8 +956,13 @@ class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler,
if __name__ == '__main__':
print('Running XML-RPC server on port 8000')
server = SimpleXMLRPCServer(("
localhost
", 8000))
server.register_function(pow)
server.register_function(lambda x,y: x+y, 'add')
server.serve_forever()
print('Serving XML-RPC on localhost port 8000')
try:
server.serve_forever()
except KeyboardInterrupt:
print("
\
nKeyboard
interrupt
received
,
exiting
.
")
server.server_close()
sys.exit(0)
Misc/NEWS
View file @
75861df9
...
...
@@ -347,6 +347,9 @@ Core and Builtins
Library
-------
-
Fix
the
xmlrpc
.
client
user
agent
to
return
something
similar
to
urllib
.
request
user
agent
:
"Python-xmlrpc/3.3"
.
-
Issue
#
13293
:
Better
error
message
when
trying
to
marshal
bytes
using
xmlrpc
.
client
.
...
...
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