Browse Source

http_client Add configuration file example

Olle E. Johansson 9 years ago
parent
commit
a7aa7a7c5a
2 changed files with 45 additions and 4 deletions
  1. 22 4
      modules/http_client/README
  2. 23 0
      modules/http_client/doc/http_client_admin.xml

+ 22 - 4
modules/http_client/README

@@ -85,8 +85,9 @@ Carsten Bock
    1.10. Set tlsverifyhost parameter
    1.10. Set tlsverifyhost parameter
    1.11. Set httpcon parameter
    1.11. Set httpcon parameter
    1.12. Set config_file parameter
    1.12. Set config_file parameter
-   1.13. http_connect() usage
-   1.14. curl_http_query() usage
+   1.13. Short http_client config file
+   1.14. http_connect() usage
+   1.15. curl_http_query() usage
 
 
 Chapter 1. Admin Guide
 Chapter 1. Admin Guide
 
 
@@ -404,11 +405,28 @@ tstuff;timeout=12")
 
 
    By default no config file is specified.
    By default no config file is specified.
 
 
+   All the parameters that take filenames as values will be resolved using
+   the same rules as for the tls config filename itself: starting with a
+   '.' means relative to the working directory, a '/' means an absolute
+   path and anything else a path relative to the directory of the current
+   Kamailio main config file.
+
    Example 1.12. Set config_file parameter
    Example 1.12. Set config_file parameter
 ...
 ...
 modparam("http_client", "config_file", "httpconnections.cfg)
 modparam("http_client", "config_file", "httpconnections.cfg)
 ...
 ...
 
 
+   Example 1.13. Short http_client config file
+[authapiserver]
+url = https://api.runbo.example.com/v4.2/auth
+timeout = 1
+maxdatasize = 4
+tlsversion = TLSv2
+verify_peer = yes
+client_key = default_key.pem
+client_cert = default_cert.pem
+http_follow_redirect = no
+
 4. Functions
 4. Functions
 
 
    4.1. http_connect(connection, url, [content_type, data,] result)
    4.1. http_connect(connection, url, [content_type, data,] result)
@@ -436,7 +454,7 @@ modparam("http_client", "config_file", "httpconnections.cfg)
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
    FAILURE_ROUTE, and BRANCH_ROUTE.
    FAILURE_ROUTE, and BRANCH_ROUTE.
 
 
-   Example 1.13. http_connect() usage
+   Example 1.14. http_connect() usage
 ...
 ...
 modparam("http_client", "httpcon", "apiserver=>http://kamailio.org/api/");
 modparam("http_client", "httpcon", "apiserver=>http://kamailio.org/api/");
 ...
 ...
@@ -474,7 +492,7 @@ xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n"
    utils module. It is changed to use the same base library and settings
    utils module. It is changed to use the same base library and settings
    as the rest of the functions in this module.
    as the rest of the functions in this module.
 
 
-   Example 1.14. curl_http_query() usage
+   Example 1.15. curl_http_query() usage
 ...
 ...
 # GET-Request
 # GET-Request
 http_client_query("http://tutpro.com/index.php?r_uri=$(ru{s.escape.param})&f_uri
 http_client_query("http://tutpro.com/index.php?r_uri=$(ru{s.escape.param})&f_uri

+ 23 - 0
modules/http_client/doc/http_client_admin.xml

@@ -399,6 +399,13 @@ modparam("http_client", "httpcon", "apifour=>http://stockholm.example.com/api/ge
         		<para>
         		<para>
                 	By default no config file is specified.
                 	By default no config file is specified.
         		</para>
         		</para>
+ 			<para>
+                	All the parameters that take filenames as values will be resolved
+                	using the same rules as for the tls config filename itself: starting
+                	with a '.' means relative to the working directory, a '/' means an
+                	absolute path and  anything else a path relative to the directory of
+                	the current &kamailio; main config file.
+        		</para>
 			<example>
 			<example>
 			<title>Set <varname>config_file</varname> parameter</title>
 			<title>Set <varname>config_file</varname> parameter</title>
 				<programlisting format="linespecific">
 				<programlisting format="linespecific">
@@ -407,6 +414,22 @@ modparam("http_client", "config_file", "httpconnections.cfg)
 ...
 ...
 				</programlisting>
 				</programlisting>
 			</example>
 			</example>
+			<example>
+                	<title>Short http_client config file</title>
+        <programlisting>
+[authapiserver]
+url = https://api.runbo.example.com/v4.2/auth
+timeout = 1
+maxdatasize = 4 
+tlsversion = TLSv2
+verify_peer = yes
+client_key = default_key.pem
+client_cert = default_cert.pem
+http_follow_redirect = no
+
+        </programlisting>
+        </example>
+
 		</section>
 		</section>
 	</section>
 	</section>