Lines Matching +full:x +full:- +full:forwarded +full:- +full:for
1 r"""XML-RPC Servers.
3 This module can be used to create simple XML-RPC servers
8 It can also be used to handle XML-RPC requests in a CGI
11 The Doc* classes can be used to create XML-RPC servers that
12 serve pydoc-style documentation in response to HTTP
23 server.register_function(lambda x,y: x+y, 'add')
37 ['sys.' + method for method in list_public_methods(self.sys)]
38 def pow(self, x, y): return pow(x, y)
39 def add(self, x, y) : return x + y
50 # this method must be present for system.listMethods
54 # this method must be present for system.methodHelp
59 return "pow(x, y[, z]) => number"
83 # callable through XML-RPC to prevent potential security
91 def export_add(self, x, y):
92 return x + y
139 for i in attrs:
152 return [member for member in dir(obj)
157 """Mix-in class that dispatches XML-RPC requests.
159 This class is used to register XML-RPC method handlers
170 self.encoding = encoding or 'utf-8'
174 """Registers an instance to respond to XML-RPC requests.
179 method will be called with the name of the XML-RPC method and
189 If a registered function matches an XML-RPC request, then it
210 """Registers a function to respond to XML-RPC requests.
213 for the function.
226 """Registers the XML-RPC introspection methods in the system
237 """Registers the XML-RPC multicall method in the system
245 """Dispatches an XML-RPC method from marshalled (XML) data.
247 XML-RPC methods are dispatched from the marshalled (XML) data
249 marshalled data. For backwards compatibility, a dispatch
319 Returns a string containing documentation for the specified method."""
325 # Instance can implement _methodHelp to return help for a method
351 Allows the caller to package multiple XML-RPC calls into a single
358 for call in call_list:
384 """Dispatches the XML-RPC method.
386 XML-RPC calls are forwarded to a registered function that
387 matches the called XML-RPC method name. If no such function
388 exists then the call is forwarded to the registered instance,
392 method will be called with the name of the XML-RPC method and
435 """Simple XML-RPC request handler class.
438 XML-RPC requests.
450 wbufsize = -1
453 # a re to match a gzip Accept-Encoding
455 \s* ([^\s;]+) \s* #content-coding
456 (;\s* q \s*=\s* ([0-9\.]+))? #q
461 ae = self.headers.get("Accept-Encoding", "")
462 for e in ae.split(","):
480 Attempts to interpret all HTTP POST requests as XML-RPC calls,
481 which are forwarded to the server's _dispatch method for handling.
495 size_remaining = int(self.headers["content-length"])
503 size_remaining -= len(L[-1])
525 self.send_header("X-exception", str(e))
528 self.send_header("X-traceback", trace)
530 self.send_header("Content-length", "0")
534 self.send_header("Content-type", "text/xml")
541 self.send_header("Content-Encoding", "gzip")
544 self.send_header("Content-length", str(len(response)))
550 encoding = self.headers.get("content-encoding", "identity").lower()
562 self.send_header("Content-length", "0")
569 self.send_header("Content-type", "text/plain")
570 self.send_header("Content-length", str(len(response)))
574 def log_request(self, code='-', size='-'):
582 """Simple XML-RPC server.
584 Simple XML-RPC server that allows functions and a single instance
586 attempts to dispatch XML-RPC calls to the functions or instance
593 # Warning: this is for debugging purposes only! Never set this to True in
609 """Multipath XML-RPC Server
613 'virtual XML-RPC servers' at the same port.
624 self.encoding = encoding or 'utf-8'
653 """Simple handler for XML-RPC data passed through CGI."""
659 """Handle a single XML-RPC request"""
663 print('Content-Type: text/xml')
664 print('Content-Length: %d' % len(response))
674 XML-RPC uses the POST method.
686 response = response.encode('utf-8')
688 print('Content-Type: %s' % http.server.DEFAULT_ERROR_CONTENT_TYPE)
689 print('Content-Length: %d' % len(response))
696 """Handle a single XML-RPC request passed through a CGI post method.
699 XML-RPC response is printed to stdout along with the correct HTTP
711 length = -1
718 # -----------------------------------------------------------------------------
719 # Self documenting XML-RPC Server.
722 """Class used to generate pydoc HTML document for a server"""
725 """Mark up some plain text, given a context of symbols to look for.
731 # XXX Note that this regular expression does not allow for the
736 r'RFC[- ]?(\d+)|'
737 r'PEP[- ]?(\d+)|'
750 url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
753 url = 'https://www.python.org/dev/peps/pep-%04d/' % int(pep)
767 """Produce HTML documentation for a function or method object."""
769 anchor = (cl and cl.__name__ or '') + '-' + name
795 """Produce HTML documentation for an XML-RPC server."""
798 for key, value in methods.items():
799 fdict[key] = '#-' + key
812 for key, value in method_items:
820 """Generates documentation for an XML-RPC server.
822 This class is designed as mix-in and should not
827 # setup variables used for HTML documentation
828 self.server_name = 'XML-RPC Server Documentation'
830 "This server exports the following methods through the XML-RPC "\
832 self.server_title = 'XML-RPC Server Documentation'
845 """Set the documentation string for the entire server."""
850 """generate_html_documentation() => html documentation for the server
852 Generates HTML documentation for the server using introspection for
862 for method_name in self.system_listMethods():
901 """XML-RPC and documentation request handler class.
904 XML-RPC requests.
907 for documentation.
913 Interpret all HTTP GET requests as requests for server
921 response = self.server.generate_html_documentation().encode('utf-8')
923 self.send_header("Content-type", "text/html")
924 self.send_header("Content-length", str(len(response)))
930 """XML-RPC and HTML documentation server.
946 """Handler for XML-RPC data and documentation requests passed through
952 Interpret all HTTP GET requests as requests for server
956 response = self.generate_html_documentation().encode('utf-8')
958 print('Content-Type: text/html')
959 print('Content-Length: %d' % len(response))
984 server.register_function(lambda x,y: x+y, 'add')
987 print('Serving XML-RPC on localhost port 8000')