Browse code

http_client: docs for query_result parameter

Daniel-Constantin Mierla authored on 13/08/2019 07:15:43
Showing 1 changed files
... ...
@@ -36,10 +36,10 @@
36 36
 	<para>
37 37
 	Like in SIP, the HTTP URL may need encoding to be transported safely
38 38
 	over the network. Check the string encoding functions in the Transformation
39
-	Cookbook (as used in the http_client_query example below).
39
+	Cookbook (as used in the http_client_query() example below).
40 40
 	</para>
41 41
 	<para>
42
-	The function http_client_query allows &kamailio; to issue an HTTP GET
42
+	The function http_client_query() allows &kamailio; to issue an HTTP GET
43 43
 	request and get access to parts of the reply. This function has
44 44
 	been ported from the utils module and now use the same libcurl
45 45
 	functions. We recommend using the new functionality provided by
... ...
@@ -437,6 +437,31 @@ modparam("http_client", "keep_connections", 1)
437 437
 				</programlisting>
438 438
 			</example>
439 439
 		</section>
440
+		<section id="http_client.p.query_result">
441
+			<title><varname>query_result</varname> (int)</title>
442
+			<para>
443
+			Control what is returned by the http_client_query(...) in the result
444
+			variable.
445
+			</para>
446
+			<para>
447
+			Valid values are:
448
+				<itemizedlist>
449
+				<listitem><para>0 - Return the entire HTTP result body</para></listitem>
450
+				<listitem><para>1 - Return the first oine from HTTP result body</para></listitem>
451
+				</itemizedlist>
452
+			</para>
453
+			<para>
454
+			Default value: 1 (return first line).
455
+			</para>
456
+			<example>
457
+			<title>Set <varname>query_result</varname> parameter</title>
458
+				<programlisting format="linespecific">
459
+...
460
+modparam("http_client", "query_result", 0)
461
+...
462
+				</programlisting>
463
+			</example>
464
+		</section>
440 465
 		<section id="http_client.p.httpcon">
441 466
 			<title><varname>httpcon</varname> (string)</title>
442 467
 			<para>
... ...
@@ -796,17 +821,18 @@ http_get_redirect("apiserver", "$var(targeturl)");
796 796
 			</para>
797 797
 			<para>
798 798
 			If HTTP server returns a class 2xx, 3xx or 4xx reply,
799
-			the first line of the reply's body (if any) is
799
+			the first line or the entire reply body (if any) is
800 800
 			stored in <quote>result</quote> parameter,
801
-			which must be a	writable pseudo	variable.
801
+			which must be a	writable pseudo	variable. See the query_result
802
+			parameter for controling what value to be stored in the result
803
+			variable.
802 804
 			</para>
803 805
 			<para>
804 806
 			Function returns reply code of HTTP reply or -1
805 807
 			if something went wrong.
806 808
 			</para>
807 809
 			<para>
808
-			This function can be used from REQUEST_ROUTE,
809
-			ONREPLY_ROUTE, FAILURE_ROUTE, and BRANCH_ROUTE.
810
+			This function can be used from ANY_ROUTE.
810 811
 			</para>
811 812
 			<para>
812 813
 			Note that this function is based on the http_query function in the utils module.