123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
- <section id="xmlrpc.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
- <sectioninfo>
- </sectioninfo>
- <title>Functions</title>
- <section id="xmlrpc.dispatch_rpc">
- <title>
- <function>dispatch_rpc()</function>
- </title>
- <para>
- This function processes an XMLRPC request, found in the body of
- the request.
- </para>
- <para>
- It should be used only in a route specified using the
- <varname>"route"</varname> module parameter or if the request method
- is GET or POST (using it for other request methods will not have
- adverse side-effects, but it will probably not work).
- </para>
- <para>
- dispatch_rpc() extracts the XML-RPC document from the body of the
- request to determine the name of the RPC method to be called and then
- it searches through the list of all the RPC functions to find a
- function with matching name. If such a function is found then
- dispatch_rpc() will pass control to the function to handle the
- request.
- </para>
- <example>
- <title><function>dispatch_rpc</function> usage</title>
- <programlisting>
- #...
- modparam("xmlrpc", "route", "XMLRPC");
- #...
- route[XMLRPC]{
- if search("^User-Agent:.*xmlrpclib"))
- set_reply_close();
- set_reply_no_connect(); # optional
- dispatch_rpc();
- }
- </programlisting>
- </example>
- </section>
- <section id="xmlrpc.xmlrpc_reply">
- <title>
- <function>xmlrpc_reply(code, reason)</function>
- </title>
- <para>
- This function can be called from the config script to directly
- generate an XML-RPC reply.
- </para>
- <example>
- <title><function>xmlrpc_reply</function> usage</title>
- <programlisting>
- #...
- modparam("xmlrpc", "route", "XMLRPC");
- #...
- route[XMLRPC]{
- # allow XMLRPC requests only on TLS and only if the client
- # certificate is valid
- if (proto!=TLS){
- xmlrpc_reply("400", "xmlrpc allowed only over TLS");
- return;
- }
- if (@tls.peer.verified!=""){
- xmlrpc_reply("400", "Unauthorized");
- return;
- }
- if search("^User-Agent:.*xmlrpclib"))
- set_reply_close();
- set_reply_no_connect(); # optional
- dispatch_rpc();
- }
- </programlisting>
- </example>
- </section>
- </section>
|