xmlrpc_functions.xml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
  4. <section id="xmlrpc.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
  5. <sectioninfo>
  6. </sectioninfo>
  7. <title>Functions</title>
  8. <section id="xmlrpc.dispatch_rpc">
  9. <title>
  10. <function>dispatch_rpc()</function>
  11. </title>
  12. <para>
  13. This function processes an XMLRPC request, found in the body of
  14. the request.
  15. </para>
  16. <para>
  17. It should be used only in a route specified using the
  18. <varname>"route"</varname> module parameter or if the request method
  19. is GET or POST (using it for other request methods will not have
  20. adverse side-effects, but it will probably not work).
  21. </para>
  22. <para>
  23. dispatch_rpc() extracts the XML-RPC document from the body of the
  24. request to determine the name of the RPC method to be called and then
  25. it searches through the list of all the RPC functions to find a
  26. function with matching name. If such a function is found then
  27. dispatch_rpc() will pass control to the function to handle the
  28. request.
  29. </para>
  30. <example>
  31. <title><function>dispatch_rpc</function> usage</title>
  32. <programlisting>
  33. #...
  34. modparam("xmlrpc", "route", "XMLRPC");
  35. #...
  36. route[XMLRPC]{
  37. if search("^User-Agent:.*xmlrpclib"))
  38. set_reply_close();
  39. set_reply_no_connect(); # optional
  40. dispatch_rpc();
  41. }
  42. </programlisting>
  43. </example>
  44. </section>
  45. <section id="xmlrpc.xmlrpc_reply">
  46. <title>
  47. <function>xmlrpc_reply(code, reason)</function>
  48. </title>
  49. <para>
  50. This function can be called from the config script to directly
  51. generate an XML-RPC reply.
  52. </para>
  53. <example>
  54. <title><function>xmlrpc_reply</function> usage</title>
  55. <programlisting>
  56. #...
  57. modparam("xmlrpc", "route", "XMLRPC");
  58. #...
  59. route[XMLRPC]{
  60. # allow XMLRPC requests only on TLS and only if the client
  61. # certificate is valid
  62. if (proto!=TLS){
  63. xmlrpc_reply("400", "xmlrpc allowed only over TLS");
  64. return;
  65. }
  66. if (@tls.peer.verified!=""){
  67. xmlrpc_reply("400", "Unauthorized");
  68. return;
  69. }
  70. if search("^User-Agent:.*xmlrpclib"))
  71. set_reply_close();
  72. set_reply_no_connect(); # optional
  73. dispatch_rpc();
  74. }
  75. </programlisting>
  76. </example>
  77. </section>
  78. </section>