2
0
Эх сурвалжийг харах

http_client Rename "curlcon" => "httpcon"

Olle E. Johansson 9 жил өмнө
parent
commit
8c303bf1e9

+ 17 - 19
modules/http_client/README

@@ -41,7 +41,7 @@ Carsten Bock
               3.8. tlscipherlist (string)
               3.8. tlscipherlist (string)
               3.9. tlsverifypeer (int)
               3.9. tlsverifypeer (int)
               3.10. tlsverifyhost (int)
               3.10. tlsverifyhost (int)
-              3.11. curlcon (string)
+              3.11. httpcon (string)
 
 
         4. Functions
         4. Functions
 
 
@@ -76,7 +76,7 @@ Carsten Bock
    1.8. Set tlscipherlist parameter
    1.8. Set tlscipherlist parameter
    1.9. Set tlsverifypeer parameter
    1.9. Set tlsverifypeer parameter
    1.10. Set tlsverifyhost parameter
    1.10. Set tlsverifyhost parameter
-   1.11. Set curlcon parameter
+   1.11. Set httpcon parameter
    1.12. http_connect() usage
    1.12. http_connect() usage
    1.13. curl_http_query() usage
    1.13. curl_http_query() usage
 
 
@@ -102,7 +102,7 @@ Chapter 1. Admin Guide
         3.8. tlscipherlist (string)
         3.8. tlscipherlist (string)
         3.9. tlsverifypeer (int)
         3.9. tlsverifypeer (int)
         3.10. tlsverifyhost (int)
         3.10. tlsverifyhost (int)
-        3.11. curlcon (string)
+        3.11. httpcon (string)
 
 
    4. Functions
    4. Functions
 
 
@@ -173,7 +173,7 @@ Chapter 1. Admin Guide
    3.8. tlscipherlist (string)
    3.8. tlscipherlist (string)
    3.9. tlsverifypeer (int)
    3.9. tlsverifypeer (int)
    3.10. tlsverifyhost (int)
    3.10. tlsverifyhost (int)
-   3.11. curlcon (string)
+   3.11. httpcon (string)
 
 
 3.1. httpredirect (int)
 3.1. httpredirect (int)
 
 
@@ -318,7 +318,7 @@ modparam("http_client", "tlsverifypeer", 1)
 modparam("http_client", "tlsverifyhost", 2)
 modparam("http_client", "tlsverifyhost", 2)
 ...
 ...
 
 
-3.11. curlcon (string)
+3.11. httpcon (string)
 
 
    Defines a connection and credentials for the connection for use in a
    Defines a connection and credentials for the connection for use in a
    connection-oriented function call in this module.
    connection-oriented function call in this module.
@@ -327,7 +327,7 @@ modparam("http_client", "tlsverifyhost", 2)
    <connection-name>=><schema>://[<username>:<password>@]<hostname/address
    <connection-name>=><schema>://[<username>:<password>@]<hostname/address
    >[;param=value]
    >[;param=value]
 
 
-   The address in the URL is the base for the URL in the curlcon_query()
+   The address in the URL is the base for the URL in the http_connect()
    call. The address given in the function call will be appended to the
    call. The address given in the function call will be appended to the
    base URL in the connection definition.
    base URL in the connection definition.
 
 
@@ -347,15 +347,14 @@ modparam("http_client", "tlsverifyhost", 2)
      * verifyhost Set to 2 to enable or 0 to disable server hostname
      * verifyhost Set to 2 to enable or 0 to disable server hostname
        verification. Overrides tlsverifyhost modparam.
        verification. Overrides tlsverifyhost modparam.
 
 
-   Example 1.11. Set curlcon parameter
+   Example 1.11. Set httpcon parameter
 ...
 ...
-modparam("http_client", "http_client.on", "apione=>http://atlanta.example.com")
-modparam("http_client", "http_client.on", "apitwo=>http://atlanta.example.com/ap
-i/12")
-modparam("http_client", "http_client.on", "apithree=>http://annabella:mysecret@a
-tlanta.example.com/api/12")
-modparam("http_client", "http_client.on", "apifour=>http://stockholm.example.com
-/api/getstuff;timeout=12")
+modparam("http_client", "httpcon", "apione=>http://atlanta.example.com")
+modparam("http_client", "httpcon", "apitwo=>http://atlanta.example.com/api/12")
+modparam("http_client", "httpcon", "apithree=>http://annabella:mysecret@atlanta.
+example.com/api/12")
+modparam("http_client", "httpcon", "apifour=>http://stockholm.example.com/api/ge
+tstuff;timeout=12")
 ...
 ...
 
 
 4. Functions
 4. Functions
@@ -367,8 +366,8 @@ modparam("http_client", "http_client.on", "apifour=>http://stockholm.example.com
 
 
    Sends HTTP GET or POST request to a given connection. For a POST
    Sends HTTP GET or POST request to a given connection. For a POST
    request, content-type can be specified.
    request, content-type can be specified.
-     * connection - the name of an existing curl connection, definied by a
-       modparam.
+     * connection - the name of an existing HTTP connection, definied by a
+       httpcon modparam.
        url - the part of the URL to add to the predefined URL in the
        url - the part of the URL to add to the predefined URL in the
        connection definition.
        connection definition.
        content_type - Used only when posting data with HTTP POST. An
        content_type - Used only when posting data with HTTP POST. An
@@ -387,8 +386,7 @@ modparam("http_client", "http_client.on", "apifour=>http://stockholm.example.com
 
 
    Example 1.12. http_connect() usage
    Example 1.12. http_connect() usage
 ...
 ...
-modparam("http_client", "http_client.on", "apiserver=>http://kamailio.org/api/")
-;
+modparam("http_client", "httpcon", "apiserver=>http://kamailio.org/api/");
 ...
 ...
 # POST Request
 # POST Request
 $var(res) = http_connect("apiserver", "/mailbox", "application/json", "{ ok, {20
 $var(res) = http_connect("apiserver", "/mailbox", "application/json", "{ ok, {20
@@ -462,7 +460,7 @@ switch ($retcode) {
 
 
 6.1. httpclient.listcon
 6.1. httpclient.listcon
 
 
-   Lists all defined connections
+   Lists all defined httpcon connections
 
 
    Parameters:
    Parameters:
      * No parameters
      * No parameters

+ 7 - 7
modules/http_client/curlcon.c

@@ -22,7 +22,7 @@
  */
  */
 
 
 /*! \file
 /*! \file
- * \brief  Kamailio http_client :: Connectoin handling
+ * \brief  Kamailio http_client :: Connection handling
  * \ingroup http_client
  * \ingroup http_client
  */
  */
 
 
@@ -68,7 +68,7 @@ curl_con_t* curl_get_connection(str *name)
 	unsigned int conid;
 	unsigned int conid;
 
 
 	conid = core_case_hash(name, 0, 0);
 	conid = core_case_hash(name, 0, 0);
-	LM_DBG("curl_get_connection looking for curlcon: [%.*s] ID %u\n", name->len, name->s, conid);
+	LM_DBG("curl_get_connection looking for httpcon: [%.*s] ID %u\n", name->len, name->s, conid);
 
 
 	cc = _curl_con_root;
 	cc = _curl_con_root;
 	while(cc)
 	while(cc)
@@ -78,12 +78,12 @@ curl_con_t* curl_get_connection(str *name)
 		}
 		}
 		cc = cc->next;
 		cc = cc->next;
 	}
 	}
-	LM_DBG("curl_get_connection no success in looking for curlcon: [%.*s]\n", name->len, name->s);
+	LM_DBG("curl_get_connection no success in looking for httpcon: [%.*s]\n", name->len, name->s);
 	return NULL;
 	return NULL;
 }
 }
 
 
 
 
-/*! Parse the curlcon module parameter
+/*! Parse the httpcon module parameter
  *
  *
  *	Syntax:
  *	Syntax:
  *		name => proto://user:password@server/url/url
  *		name => proto://user:password@server/url/url
@@ -131,7 +131,7 @@ int curl_parse_param(char *val)
 	curl_con_t *cc;
 	curl_con_t *cc;
 
 
 	LM_INFO("curl modparam parsing starting\n");
 	LM_INFO("curl modparam parsing starting\n");
-	LM_DBG("modparam curlcon: %s\n", val);
+	LM_DBG("modparam httpcon: %s\n", val);
 
 
 	/* parse: name=>http_url*/
 	/* parse: name=>http_url*/
 	in.s = val;
 	in.s = val;
@@ -268,7 +268,7 @@ int curl_parse_param(char *val)
 
 
 		if (parse_params(&params, CLASS_ANY, &phooks, &conparams) < 0)
 		if (parse_params(&params, CLASS_ANY, &phooks, &conparams) < 0)
                 {
                 {
-                        LM_ERR("CURL failed parsing curlcon parameters value\n");
+                        LM_ERR("CURL failed parsing httpcon parameters value\n");
                         goto error;
                         goto error;
                 }
                 }
 
 
@@ -408,7 +408,7 @@ curl_con_t *curl_init_con(str *name)
 	unsigned int conid;
 	unsigned int conid;
 
 
 	conid = core_case_hash(name, 0, 0);
 	conid = core_case_hash(name, 0, 0);
-	LM_DBG("curl_init_con curlcon: [%.*s] ID %u\n", name->len, name->s, conid);
+	LM_DBG("curl_init_con httpcon: [%.*s] ID %u\n", name->len, name->s, conid);
 
 
 	cc = _curl_con_root;
 	cc = _curl_con_root;
 	while(cc)
 	while(cc)

+ 11 - 11
modules/http_client/doc/http_client_admin.xml

@@ -295,8 +295,8 @@ modparam("http_client", "tlsverifyhost", 2)
 				</programlisting>
 				</programlisting>
 			</example>
 			</example>
 		</section>
 		</section>
-		<section id="http_client.p.curlcon">
-			<title><varname>curlcon</varname> (string)</title>
+		<section id="http_client.p.httpcon">
+			<title><varname>httpcon</varname> (string)</title>
 			<para>
 			<para>
 			Defines a connection and credentials for the connection for use
 			Defines a connection and credentials for the connection for use
 			in a connection-oriented function call in this module.
 			in a connection-oriented function call in this module.
@@ -306,7 +306,7 @@ modparam("http_client", "tlsverifyhost", 2)
 			&lt;connection-name&gt;=&gt;&lt;schema&gt;://[&lt;username&gt;:&lt;password&gt;@]&lt;hostname/address&gt;[;param=value]
 			&lt;connection-name&gt;=&gt;&lt;schema&gt;://[&lt;username&gt;:&lt;password&gt;@]&lt;hostname/address&gt;[;param=value]
 			</para>
 			</para>
 			<para>
 			<para>
-			The address in the URL is the base for the URL in the <function>curlcon_query()</function> call. The
+			The address in the URL is the base for the URL in the <function>http_connect()</function> call. The
 			address given in the function call will be appended to the base URL in the connection definition.
 			address given in the function call will be appended to the base URL in the connection definition.
 			</para>
 			</para>
 			<para>
 			<para>
@@ -346,13 +346,13 @@ modparam("http_client", "tlsverifyhost", 2)
 			</itemizedlist>
 			</itemizedlist>
 			</para>
 			</para>
 			<example>
 			<example>
-			<title>Set <varname>curlcon</varname> parameter</title>
+			<title>Set <varname>httpcon</varname> parameter</title>
 				<programlisting format="linespecific">
 				<programlisting format="linespecific">
 ...
 ...
-modparam("http_client", "http_client.on", "apione=>http://atlanta.example.com")
-modparam("http_client", "http_client.on", "apitwo=>http://atlanta.example.com/api/12")
-modparam("http_client", "http_client.on", "apithree=>http://annabella:[email protected]/api/12")
-modparam("http_client", "http_client.on", "apifour=>http://stockholm.example.com/api/getstuff;timeout=12")
+modparam("http_client", "httpcon", "apione=>http://atlanta.example.com")
+modparam("http_client", "httpcon", "apitwo=>http://atlanta.example.com/api/12")
+modparam("http_client", "httpcon", "apithree=>http://annabella:[email protected]/api/12")
+modparam("http_client", "httpcon", "apifour=>http://stockholm.example.com/api/getstuff;timeout=12")
 ...
 ...
 				</programlisting>
 				</programlisting>
 			</example>
 			</example>
@@ -373,7 +373,7 @@ modparam("http_client", "http_client.on", "apifour=>http://stockholm.example.com
                 		<listitem>
                 		<listitem>
                         		<para>
                         		<para>
                                 		<emphasis>connection</emphasis> - the name of an existing
                                 		<emphasis>connection</emphasis> - the name of an existing
-						curl connection, definied by a modparam.
+						HTTP connection, definied by a httpcon modparam.
 					</para>
 					</para>
                         		<para>
                         		<para>
                                 		<emphasis>url</emphasis> - the part of the URL to add to the
                                 		<emphasis>url</emphasis> - the part of the URL to add to the
@@ -408,7 +408,7 @@ modparam("http_client", "http_client.on", "apifour=>http://stockholm.example.com
 				<title><function>http_connect()</function> usage</title>
 				<title><function>http_connect()</function> usage</title>
 				<programlisting format="linespecific">
 				<programlisting format="linespecific">
 ...
 ...
-modparam("http_client", "http_client.on", "apiserver=>http://kamailio.org/api/");
+modparam("http_client", "httpcon", "apiserver=>http://kamailio.org/api/");
 ...
 ...
 # POST Request
 # POST Request
 $var(res) = http_connect("apiserver", "/mailbox", "application/json", "{ ok, {200, ok}}", "$avp(gurka)");
 $var(res) = http_connect("apiserver", "/mailbox", "application/json", "{ ok, {200, ok}}", "$avp(gurka)");
@@ -497,7 +497,7 @@ switch ($retcode) {
 		<section>
 		<section>
 			<title><function moreinfo="none">httpclient.listcon</function></title>
 			<title><function moreinfo="none">httpclient.listcon</function></title>
 			<para>
 			<para>
-				Lists all defined connections
+				Lists all defined httpcon connections
 			</para>
 			</para>
 		<para>Parameters:</para>
 		<para>Parameters:</para>
 		<itemizedlist>
 		<itemizedlist>

+ 6 - 6
modules/http_client/http_client.c

@@ -138,7 +138,7 @@ static cmd_export_t cmds[] = {
 /* Exported parameters */
 /* Exported parameters */
 static param_export_t params[] = {
 static param_export_t params[] = {
     	{"connection_timeout", PARAM_INT, &default_connection_timeout},
     	{"connection_timeout", PARAM_INT, &default_connection_timeout},
-	{"curlcon",  PARAM_STRING|USE_FUNC_PARAM, (void*)curl_con_param},
+	{"httpcon",  PARAM_STRING|USE_FUNC_PARAM, (void*)curl_con_param},
 	{"tlscacert", PARAM_STRING,  &default_tls_cacert },
 	{"tlscacert", PARAM_STRING,  &default_tls_cacert },
 	{"tlsclientcert", PARAM_STR, &default_tls_clientcert },
 	{"tlsclientcert", PARAM_STR, &default_tls_clientcert },
 	{"tlsclientkey", PARAM_STR, &default_tls_clientkey },
 	{"tlsclientkey", PARAM_STR, &default_tls_clientkey },
@@ -204,7 +204,7 @@ static void destroy_shmlock(void)
 /* Init counters */
 /* Init counters */
 static void curl_counter_init()
 static void curl_counter_init()
 {
 {
-        counter_register(&connections, "httpclient", "connections", 0, 0, 0, "Counter of connection definitions (curlcon)", 0);
+        counter_register(&connections, "httpclient", "connections", 0, 0, 0, "Counter of connection definitions (httpcon)", 0);
         counter_register(&connok, "httpclient", "connok", 0, 0, 0, "Counter of successful connections (200 OK)", 0);
         counter_register(&connok, "httpclient", "connok", 0, 0, 0, "Counter of successful connections (200 OK)", 0);
         counter_register(&connfail, "httpclient", "connfail", 0, 0, 0, "Counter of failed connections (not 200 OK)", 0);
         counter_register(&connfail, "httpclient", "connfail", 0, 0, 0, "Counter of failed connections (not 200 OK)", 0);
 }
 }
@@ -299,7 +299,7 @@ static void destroy(void)
 
 
 
 
 /**
 /**
- * parse curlcon module parameter
+ * parse httpcon module parameter
  */
  */
 int curl_con_param(modparam_t type, void *val)
 int curl_con_param(modparam_t type, void *val)
 {
 {
@@ -307,7 +307,7 @@ int curl_con_param(modparam_t type, void *val)
 		goto error;
 		goto error;
 	}
 	}
 
 
-	LM_DBG("**** CURL got modparam curlcon \n");
+	LM_DBG("**** HTTP_CLIENT got modparam httpcon \n");
 	return curl_parse_param((char*)val);
 	return curl_parse_param((char*)val);
 error:
 error:
 	return -1;
 	return -1;
@@ -712,8 +712,8 @@ static int pv_parse_curlredirect(pv_spec_p sp, str *in)
 }
 }
 
 
 /*
 /*
- * PV - return curl redirect URL for curlcon
- *	$curlredirect("curlcon");
+ * PV - return curl redirect URL for httpcon
+ *	$curlredirect("httpcon");
  */
  */
 static int pv_get_curlredirect(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
 static int pv_get_curlredirect(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
 {
 {