Browse code

modules: readme files regenerated - http_client ... [skip ci]

Kamailio Dev authored on 23/06/2021 11:16:19
Showing 1 changed files
... ...
@@ -503,7 +503,7 @@ modparam("http_client", "keep_connections", 1)
503 503
 
504 504
    Valid values are:
505 505
      * 0 - Return the entire HTTP result body
506
-     * 1 - Return the first oine from HTTP result body
506
+     * 1 - Return the first line from HTTP result body
507 507
 
508 508
    Default value: 1 (return first line).
509 509
 
Browse code

modules: readme files regenerated - http_client ... [skip ci]

Kamailio Dev authored on 21/12/2020 09:31:37
Showing 1 changed files
... ...
@@ -72,6 +72,7 @@ Hugh Waite
72 72
 
73 73
               4.3. http_get_redirect(connection, result)
74 74
               4.4. http_client_query(url, [post-data], [hdrs], result)
75
+              4.5. http_client_get(url, body, hdrs, respv)
75 76
 
76 77
         5. Pseudovariables
77 78
 
... ...
@@ -128,6 +129,7 @@ Hugh Waite
128 129
    1.23. http_connect_raw() usage
129 130
    1.24. http_get_redirect() usage
130 131
    1.25. http_client_query() usage
132
+   1.26. http_client_get() usage
131 133
 
132 134
 Chapter 1. Admin Guide
133 135
 
... ...
@@ -169,6 +171,7 @@ Chapter 1. Admin Guide
169 171
 
170 172
         4.3. http_get_redirect(connection, result)
171 173
         4.4. http_client_query(url, [post-data], [hdrs], result)
174
+        4.5. http_client_get(url, body, hdrs, respv)
172 175
 
173 176
    5. Pseudovariables
174 177
 
... ...
@@ -670,6 +673,7 @@ modparam("http_client", "netinterface", "eth0")
670 673
    4.2. http_connect_raw(connection, url, content_type, data, result)
671 674
    4.3. http_get_redirect(connection, result)
672 675
    4.4. http_client_query(url, [post-data], [hdrs], result)
676
+   4.5. http_client_get(url, body, hdrs, respv)
673 677
 
674 678
 4.1.  http_connect(connection, url, [content_type, data,] result)
675 679
 
... ...
@@ -818,6 +822,28 @@ http_client_query("http://api.com/index.php", "src=$si",
818 822
     "Content-Type: text/plain", "$var(result)");
819 823
 ...
820 824
 
825
+4.5.  http_client_get(url, body, hdrs, respv)
826
+
827
+   Perform a HTTP GET request to "url", storing the response body in the
828
+   "respv" variable. The "body" and "hdrs" can be empty strings to skip
829
+   setting them. The first three parameters can contain variables that are
830
+   evaluated at runtime. The "respv" has to be the name of a writable
831
+   variable.
832
+
833
+   Note: usually HTTP GET requests should have no body, according to specs
834
+   the body in HTTP GET does not affect the response, but is not
835
+   explicitely forbidden.
836
+
837
+   Example 1.26. http_client_get() usage
838
+...
839
+http_client_get("http://api.com/index.php?r_uri=$(ru{s.escape.param})&f_uri=$(fu
840
+{s.escape.param})",
841
+           "", "X-Token: abc", "$var(result)");
842
+switch ($rc) {
843
+    ...
844
+}
845
+...
846
+
821 847
 5. Pseudovariables
822 848
 
823 849
    5.1. $curlerror(error)
Browse code

modules: readme files regenerated - http_client ... [skip ci]

Kamailio Dev authored on 18/12/2020 07:31:24
Showing 1 changed files
... ...
@@ -91,7 +91,7 @@ Hugh Waite
91 91
 
92 92
    2. Developer Guide
93 93
 
94
-        1.
94
+        1. Introduction
95 95
         2. Available Functions
96 96
 
97 97
               2.1. int http_connect(msg, connection, url, result,
... ...
@@ -872,7 +872,7 @@ Chapter 2. Developer Guide
872 872
 
873 873
    Table of Contents
874 874
 
875
-   1.
875
+   1. Introduction
876 876
    2. Available Functions
877 877
 
878 878
         2.1. int http_connect(msg, connection, url, result, content_type,
... ...
@@ -882,6 +882,8 @@ Chapter 2. Developer Guide
882 882
         2.3. int http_query(msg, url, dest, post)
883 883
         2.4. http_get_content_type(str connection)
884 884
 
885
+1. Introduction
886
+
885 887
    This module provides a set of API functions that other modules can use
886 888
    in order to integrate with HTTP services.
887 889
 
Browse code

modules: readme files regenerated - http_client ... [skip ci]

Kamailio Dev authored on 17/01/2020 12:16:25
Showing 1 changed files
... ...
@@ -60,6 +60,7 @@ Hugh Waite
60 60
               3.17. query_maxdatasize (int)
61 61
               3.18. httpcon (string)
62 62
               3.19. config_file (string)
63
+              3.20. netinterface (string)
63 64
 
64 65
         4. Functions
65 66
 
... ...
@@ -122,10 +123,11 @@ Hugh Waite
122 123
    1.18. Set httpcon parameter
123 124
    1.19. Set config_file parameter
124 125
    1.20. Short http_client config file
125
-   1.21. http_connect() usage
126
-   1.22. http_connect_raw() usage
127
-   1.23. http_get_redirect() usage
128
-   1.24. http_client_query() usage
126
+   1.21. Set netinterface parameter
127
+   1.22. http_connect() usage
128
+   1.23. http_connect_raw() usage
129
+   1.24. http_get_redirect() usage
130
+   1.25. http_client_query() usage
129 131
 
130 132
 Chapter 1. Admin Guide
131 133
 
... ...
@@ -158,6 +160,7 @@ Chapter 1. Admin Guide
158 160
         3.17. query_maxdatasize (int)
159 161
         3.18. httpcon (string)
160 162
         3.19. config_file (string)
163
+        3.20. netinterface (string)
161 164
 
162 165
    4. Functions
163 166
 
... ...
@@ -254,6 +257,7 @@ Chapter 1. Admin Guide
254 257
    3.17. query_maxdatasize (int)
255 258
    3.18. httpcon (string)
256 259
    3.19. config_file (string)
260
+   3.20. netinterface (string)
257 261
 
258 262
 3.1. httpredirect (int)
259 263
 
... ...
@@ -647,6 +651,19 @@ client_key = default_key.pem
647 651
 client_cert = default_cert.pem
648 652
 http_follow_redirect = no
649 653
 
654
+3.20. netinterface (string)
655
+
656
+   Set local network interface to be used for HTTP queries. It can be
657
+   interface name or IP address. For more details see:
658
+   https://curl.haxx.se/libcurl/c/CURLOPT_INTERFACE.html .
659
+
660
+   Default value not set.
661
+
662
+   Example 1.21. Set netinterface parameter
663
+...
664
+modparam("http_client", "netinterface", "eth0")
665
+...
666
+
650 667
 4. Functions
651 668
 
652 669
    4.1. http_connect(connection, url, [content_type, data,] result)
... ...
@@ -677,7 +694,7 @@ http_follow_redirect = no
677 694
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
678 695
    FAILURE_ROUTE, and BRANCH_ROUTE.
679 696
 
680
-   Example 1.21. http_connect() usage
697
+   Example 1.22. http_connect() usage
681 698
 ...
682 699
 modparam("http_client", "httpcon", "apiserver=>http://kamailio.org/api/");
683 700
 ...
... ...
@@ -718,7 +735,7 @@ xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n"
718 735
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
719 736
    FAILURE_ROUTE, and BRANCH_ROUTE.
720 737
 
721
-   Example 1.22. http_connect_raw() usage
738
+   Example 1.23. http_connect_raw() usage
722 739
 ...
723 740
 modparam("http_client", "httpcon", "apiserver=>http://kamailio.org/api/");
724 741
 ...
... ...
@@ -745,7 +762,7 @@ xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n"
745 762
        result - The name of a pseudo variable that will contain the last
746 763
        used URL.
747 764
 
748
-   Example 1.23. http_get_redirect() usage
765
+   Example 1.24. http_get_redirect() usage
749 766
 ...
750 767
 modparam("http_client", "httpredirect", 1);
751 768
 ...
... ...
@@ -780,7 +797,7 @@ http_get_redirect("apiserver", "$var(targeturl)");
780 797
    utils module. It is changed to use the same base library and settings
781 798
    as the rest of the functions in this module.
782 799
 
783
-   Example 1.24. http_client_query() usage
800
+   Example 1.25. http_client_query() usage
784 801
 ...
785 802
 # GET-Request
786 803
 http_client_query("http://api.com/index.php?r_uri=$(ru{s.escape.param})&f_uri=$(
Browse code

modules: readme files regenerated - http_client ... [skip ci]

Kamailio Dev authored on 13/08/2019 07:32:20
Showing 1 changed files
... ...
@@ -56,8 +56,10 @@ Hugh Waite
56 56
               3.13. tlsversion (int)
57 57
               3.14. authmethod (int)
58 58
               3.15. keep_connections (int)
59
-              3.16. httpcon (string)
60
-              3.17. config_file (string)
59
+              3.16. query_result (int)
60
+              3.17. query_maxdatasize (int)
61
+              3.18. httpcon (string)
62
+              3.19. config_file (string)
61 63
 
62 64
         4. Functions
63 65
 
... ...
@@ -115,13 +117,15 @@ Hugh Waite
115 117
    1.13. Set tlsversion parameter
116 118
    1.14. Set authmethod parameter
117 119
    1.15. Set keep_connections parameter
118
-   1.16. Set httpcon parameter
119
-   1.17. Set config_file parameter
120
-   1.18. Short http_client config file
121
-   1.19. http_connect() usage
122
-   1.20. http_connect_raw() usage
123
-   1.21. http_get_redirect() usage
124
-   1.22. http_client_query() usage
120
+   1.16. Set query_result parameter
121
+   1.17. Set query_maxdatasize parameter
122
+   1.18. Set httpcon parameter
123
+   1.19. Set config_file parameter
124
+   1.20. Short http_client config file
125
+   1.21. http_connect() usage
126
+   1.22. http_connect_raw() usage
127
+   1.23. http_get_redirect() usage
128
+   1.24. http_client_query() usage
125 129
 
126 130
 Chapter 1. Admin Guide
127 131
 
... ...
@@ -150,8 +154,10 @@ Chapter 1. Admin Guide
150 154
         3.13. tlsversion (int)
151 155
         3.14. authmethod (int)
152 156
         3.15. keep_connections (int)
153
-        3.16. httpcon (string)
154
-        3.17. config_file (string)
157
+        3.16. query_result (int)
158
+        3.17. query_maxdatasize (int)
159
+        3.18. httpcon (string)
160
+        3.19. config_file (string)
155 161
 
156 162
    4. Functions
157 163
 
... ...
@@ -196,10 +202,10 @@ Chapter 1. Admin Guide
196 202
 
197 203
    Like in SIP, the HTTP URL may need encoding to be transported safely
198 204
    over the network. Check the string encoding functions in the
199
-   Transformation Cookbook (as used in the http_client_query example
205
+   Transformation Cookbook (as used in the http_client_query() example
200 206
    below).
201 207
 
202
-   The function http_client_query allows Kamailio to issue an HTTP GET
208
+   The function http_client_query() allows Kamailio to issue an HTTP GET
203 209
    request and get access to parts of the reply. This function has been
204 210
    ported from the utils module and now use the same libcurl functions. We
205 211
    recommend using the new functionality provided by this module.
... ...
@@ -244,8 +250,10 @@ Chapter 1. Admin Guide
244 250
    3.13. tlsversion (int)
245 251
    3.14. authmethod (int)
246 252
    3.15. keep_connections (int)
247
-   3.16. httpcon (string)
248
-   3.17. config_file (string)
253
+   3.16. query_result (int)
254
+   3.17. query_maxdatasize (int)
255
+   3.18. httpcon (string)
256
+   3.19. config_file (string)
249 257
 
250 258
 3.1. httpredirect (int)
251 259
 
... ...
@@ -481,7 +489,35 @@ modparam("http_client", "authmethod", 3)
481 489
 modparam("http_client", "keep_connections", 1)
482 490
 ...
483 491
 
484
-3.16. httpcon (string)
492
+3.16. query_result (int)
493
+
494
+   Control what is returned by the http_client_query(...) in the result
495
+   variable.
496
+
497
+   Valid values are:
498
+     * 0 - Return the entire HTTP result body
499
+     * 1 - Return the first oine from HTTP result body
500
+
501
+   Default value: 1 (return first line).
502
+
503
+   Example 1.16. Set query_result parameter
504
+...
505
+modparam("http_client", "query_result", 0)
506
+...
507
+
508
+3.17. query_maxdatasize (int)
509
+
510
+   Control the size in bytes of the data to be returned by the
511
+   http_client_query(...) in the result variable.
512
+
513
+   Default value: 0 (disabled, unlimited size).
514
+
515
+   Example 1.17. Set query_maxdatasize parameter
516
+...
517
+modparam("http_client", "query_maxdatasize", 2048)
518
+...
519
+
520
+3.18. httpcon (string)
485 521
 
486 522
    Defines a connection and credentials for the connection for use in a
487 523
    connection-oriented function call in this module.
... ...
@@ -529,7 +565,7 @@ modparam("http_client", "keep_connections", 1)
529 565
        Failure is either a connection failure or a response code of 500 or
530 566
        above.
531 567
 
532
-   Example 1.16. Set httpcon parameter
568
+   Example 1.18. Set httpcon parameter
533 569
 ...
534 570
 modparam("http_client", "httpcon", "apione=>http://atlanta.example.com")
535 571
 modparam("http_client", "httpcon", "apitwo=>http://atlanta.example.com/api/12")
... ...
@@ -539,7 +575,7 @@ modparam("http_client", "httpcon", "apifour=>http://stockholm.example.com/api/ge
539 575
 tstuff;timeout=12;failover=apione")
540 576
 ...
541 577
 
542
-3.17. config_file (string)
578
+3.19. config_file (string)
543 579
 
544 580
    The file name of a configuration file containing definitions of http
545 581
    connections. This is an alternative to the "httpcon" module parameter -
... ...
@@ -595,12 +631,12 @@ tstuff;timeout=12;failover=apione")
595 631
    you can specify an value of "" - two quotation marks. In order to
596 632
    disable a http proxy setting you can set the port to zero.
597 633
 
598
-   Example 1.17. Set config_file parameter
634
+   Example 1.19. Set config_file parameter
599 635
 ...
600 636
 modparam("http_client", "config_file", "httpconnections.cfg)
601 637
 ...
602 638
 
603
-   Example 1.18. Short http_client config file
639
+   Example 1.20. Short http_client config file
604 640
 [authapiserver]
605 641
 url = https://api.runbo.example.com/v4.2/auth
606 642
 timeout = 1
... ...
@@ -641,7 +677,7 @@ http_follow_redirect = no
641 677
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
642 678
    FAILURE_ROUTE, and BRANCH_ROUTE.
643 679
 
644
-   Example 1.19. http_connect() usage
680
+   Example 1.21. http_connect() usage
645 681
 ...
646 682
 modparam("http_client", "httpcon", "apiserver=>http://kamailio.org/api/");
647 683
 ...
... ...
@@ -682,7 +718,7 @@ xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n"
682 718
    This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
683 719
    FAILURE_ROUTE, and BRANCH_ROUTE.
684 720
 
685
-   Example 1.20. http_connect_raw() usage
721
+   Example 1.22. http_connect_raw() usage
686 722
 ...
687 723
 modparam("http_client", "httpcon", "apiserver=>http://kamailio.org/api/");
688 724
 ...
... ...
@@ -709,7 +745,7 @@ xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n"
709 745
        result - The name of a pseudo variable that will contain the last
710 746
        used URL.
711 747
 
712
-   Example 1.21. http_get_redirect() usage
748
+   Example 1.23. http_get_redirect() usage
713 749
 ...
714 750
 modparam("http_client", "httpredirect", 1);
715 751
 ...
... ...
@@ -730,21 +766,21 @@ http_get_redirect("apiserver", "$var(targeturl)");
730 766
    Either of “post-data” or “hdrs” can be also set to empty string in
731 767
    order to be ignored.
732 768
 
733
-   If HTTP server returns a class 2xx, 3xx or 4xx reply, the first line of
734
-   the reply's body (if any) is stored in “result” parameter, which must
735
-   be a writable pseudo variable.
769
+   If HTTP server returns a class 2xx, 3xx or 4xx reply, the first line or
770
+   the entire reply body (if any) is stored in “result” parameter, which
771
+   must be a writable pseudo variable. See the query_result parameter for
772
+   controling what value to be stored in the result variable.
736 773
 
737 774
    Function returns reply code of HTTP reply or -1 if something went
738 775
    wrong.
739 776
 
740
-   This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
741
-   FAILURE_ROUTE, and BRANCH_ROUTE.
777
+   This function can be used from ANY_ROUTE.
742 778
 
743 779
    Note that this function is based on the http_query function in the
744 780
    utils module. It is changed to use the same base library and settings
745 781
    as the rest of the functions in this module.
746 782
 
747
-   Example 1.22. http_client_query() usage
783
+   Example 1.24. http_client_query() usage
748 784
 ...
749 785
 # GET-Request
750 786
 http_client_query("http://api.com/index.php?r_uri=$(ru{s.escape.param})&f_uri=$(
Browse code

modules: readme files regenerated - http_client ... [skip ci]

Kamailio Dev authored on 12/12/2018 09:01:57
Showing 1 changed files
... ...
@@ -64,8 +64,11 @@ Hugh Waite
64 64
               4.1. http_connect(connection, url, [content_type, data,]
65 65
                       result)
66 66
 
67
-              4.2. http_get_redirect(connection, result)
68
-              4.3. http_client_query(url, [post-data], [hdrs], result)
67
+              4.2. http_connect_raw(connection, url, content_type, data,
68
+                      result)
69
+
70
+              4.3. http_get_redirect(connection, result)
71
+              4.4. http_client_query(url, [post-data], [hdrs], result)
69 72
 
70 73
         5. Pseudovariables
71 74
 
... ...
@@ -116,8 +119,9 @@ Hugh Waite
116 119
    1.17. Set config_file parameter
117 120
    1.18. Short http_client config file
118 121
    1.19. http_connect() usage
119
-   1.20. http_get_redirect() usage
120
-   1.21. http_client_query() usage
122
+   1.20. http_connect_raw() usage
123
+   1.21. http_get_redirect() usage
124
+   1.22. http_client_query() usage
121 125
 
122 126
 Chapter 1. Admin Guide
123 127
 
... ...
@@ -152,8 +156,10 @@ Chapter 1. Admin Guide
152 156
    4. Functions
153 157
 
154 158
         4.1. http_connect(connection, url, [content_type, data,] result)
155
-        4.2. http_get_redirect(connection, result)
156
-        4.3. http_client_query(url, [post-data], [hdrs], result)
159
+        4.2. http_connect_raw(connection, url, content_type, data, result)
160
+
161
+        4.3. http_get_redirect(connection, result)
162
+        4.4. http_client_query(url, [post-data], [hdrs], result)
157 163
 
158 164
    5. Pseudovariables
159 165
 
... ...
@@ -608,8 +614,9 @@ http_follow_redirect = no
608 614
 4. Functions
609 615
 
610 616
    4.1. http_connect(connection, url, [content_type, data,] result)
611
-   4.2. http_get_redirect(connection, result)
612
-   4.3. http_client_query(url, [post-data], [hdrs], result)
617
+   4.2. http_connect_raw(connection, url, content_type, data, result)
618
+   4.3. http_get_redirect(connection, result)
619
+   4.4. http_client_query(url, [post-data], [hdrs], result)
613 620
 
614 621
 4.1.  http_connect(connection, url, [content_type, data,] result)
615 622
 
... ...
@@ -622,7 +629,8 @@ http_follow_redirect = no
622 629
        content_type - Used only when posting data with HTTP POST. An
623 630
        Internet Media type, like "application/json" or "text/plain". Will
624 631
        be added to the HTTP request as a header.
625
-       data - Data or a pseudo variable holding data to be posted.
632
+       data - Data or a pseudo variable holding data to be posted. (may
633
+       contain pseudo variable)
626 634
        result - The name of a pseudo variable that will have the data of
627 635
        the response from the HTTP server.
628 636
 
... ...
@@ -649,7 +657,48 @@ xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n"
649 657
 );
650 658
 ...
651 659
 
652
-4.2.  http_get_redirect(connection, result)
660
+4.2.  http_connect_raw(connection, url, content_type, data, result)
661
+
662
+   Sends HTTP POST request to a given connection. Similar to http_connect.
663
+   The only difference is that the data parameter will not be parsed for
664
+   pseudo variables, therefore it can safely be used for content that may
665
+   contain "$" character like JSON.
666
+     * connection - the name of an existing HTTP connection, defined by a
667
+       httpcon modparam.
668
+       url - the part of the URL to add to the predefined URL in the
669
+       connection definition.
670
+       content_type - Used only when posting data with HTTP POST. An
671
+       Internet Media type, like "application/json" or "text/plain". Will
672
+       be added to the HTTP request as a header.
673
+       data - Data or a pseudo variable holding data to be posted. (will
674
+       not be parsed for pseudo variable)
675
+       result - The name of a pseudo variable that will have the data of
676
+       the response from the HTTP server.
677
+
678
+   The return value is the HTTP return code (if >=100) or the CURL error
679
+   code if below 100. See the $curlerror pseudovariable below for more
680
+   information about CURL error codes.
681
+
682
+   This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
683
+   FAILURE_ROUTE, and BRANCH_ROUTE.
684
+
685
+   Example 1.20. http_connect_raw() usage
686
+...
687
+modparam("http_client", "httpcon", "apiserver=>http://kamailio.org/api/");
688
+...
689
+# POST Request
690
+$var(res) = http_connect_raw("apiserver", "/mailbox", "application/json", "{ ok,
691
+ {200, ok}}", "$avp(gurka)");
692
+xlog("L_INFO", "API-server HTTP connection: $avp(gurka) Result code $var(res)\n"
693
+);
694
+
695
+$var(res) = http_connect_war("apiserver", "/callroute", "application/json", "$va
696
+r(jsondata)", "$avp(route)");
697
+xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n"
698
+);
699
+...
700
+
701
+4.3.  http_get_redirect(connection, result)
653 702
 
654 703
    When a http connection gets a redirect and the connection is configured
655 704
    to follow redirects (301,302) then the target URL, the result of the
... ...
@@ -660,14 +709,14 @@ xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n"
660 709
        result - The name of a pseudo variable that will contain the last
661 710
        used URL.
662 711
 
663
-   Example 1.20. http_get_redirect() usage
712
+   Example 1.21. http_get_redirect() usage
664 713
 ...
665 714
 modparam("http_client", "httpredirect", 1);
666 715
 ...
667 716
 http_get_redirect("apiserver", "$var(targeturl)");
668 717
 ...
669 718
 
670
-4.3.  http_client_query(url, [post-data], [hdrs], result)
719
+4.4.  http_client_query(url, [post-data], [hdrs], result)
671 720
 
672 721
    Sends HTTP GET or POST request according to URL given in “url”
673 722
    parameter, which is a string that may contain pseudo variables.
... ...
@@ -695,7 +744,7 @@ http_get_redirect("apiserver", "$var(targeturl)");
695 744
    utils module. It is changed to use the same base library and settings
696 745
    as the rest of the functions in this module.
697 746
 
698
-   Example 1.21. http_client_query() usage
747
+   Example 1.22. http_client_query() usage
699 748
 ...
700 749
 # GET-Request
701 750
 http_client_query("http://api.com/index.php?r_uri=$(ru{s.escape.param})&f_uri=$(
Browse code

modules: readme files regenerated - http_client ... [skip ci]

Kamailio Dev authored on 26/09/2018 11:31:57
Showing 1 changed files
... ...
@@ -452,7 +452,7 @@ modparam("http_client", "tlsversion", 6)
452 452
    Example 1.14. Set authmethod parameter
453 453
 ...
454 454
 # Use the best of BASIC and Digest authentication.
455
-modparam("http_client", "authmetod", 3)
455
+modparam("http_client", "authmethod", 3)
456 456
 ...
457 457
 
458 458
 3.15. keep_connections (int)
Browse code

modules: readme files regenerated - acc ... [skip ci]

Kamailio Dev authored on 28/02/2018 17:03:37 • The Root committed on 28/02/2018 19:11:36
Showing 1 changed files
... ...
@@ -615,7 +615,7 @@ http_follow_redirect = no
615 615
 
616 616
    Sends HTTP GET or POST request to a given connection. For a POST
617 617
    request, content-type can be specified.
618
-     * connection - the name of an existing HTTP connection, definied by a
618
+     * connection - the name of an existing HTTP connection, defined by a
619 619
        httpcon modparam.
620 620
        url - the part of the URL to add to the predefined URL in the
621 621
        connection definition.
... ...
@@ -655,7 +655,7 @@ xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n"
655 655
    to follow redirects (301,302) then the target URL, the result of the
656 656
    redirects can be retrieved with this function after a successful
657 657
    connection.
658
-     * connection - the name of an existing HTTP connection, definied by a
658
+     * connection - the name of an existing HTTP connection, defined by a
659 659
        httpcon modparam.
660 660
        result - The name of a pseudo variable that will contain the last
661 661
        used URL.
Browse code

modules: readme files regenerated - http_client ... [skip ci]

Kamailio Dev authored on 30/06/2017 13:31:22
Showing 1 changed files
... ...
@@ -65,7 +65,7 @@ Hugh Waite
65 65
                       result)
66 66
 
67 67
               4.2. http_get_redirect(connection, result)
68
-              4.3. http_client_query(url, [post-data], result)
68
+              4.3. http_client_query(url, [post-data], [hdrs], result)
69 69
 
70 70
         5. Pseudovariables
71 71
 
... ...
@@ -117,7 +117,7 @@ Hugh Waite
117 117
    1.18. Short http_client config file
118 118
    1.19. http_connect() usage
119 119
    1.20. http_get_redirect() usage
120
-   1.21. curl_http_query() usage
120
+   1.21. http_client_query() usage
121 121
 
122 122
 Chapter 1. Admin Guide
123 123
 
... ...
@@ -153,7 +153,7 @@ Chapter 1. Admin Guide
153 153
 
154 154
         4.1. http_connect(connection, url, [content_type, data,] result)
155 155
         4.2. http_get_redirect(connection, result)
156
-        4.3. http_client_query(url, [post-data], result)
156
+        4.3. http_client_query(url, [post-data], [hdrs], result)
157 157
 
158 158
    5. Pseudovariables
159 159
 
... ...
@@ -609,7 +609,7 @@ http_follow_redirect = no
609 609
 
610 610
    4.1. http_connect(connection, url, [content_type, data,] result)
611 611
    4.2. http_get_redirect(connection, result)
612
-   4.3. http_client_query(url, [post-data], result)
612
+   4.3. http_client_query(url, [post-data], [hdrs], result)
613 613
 
614 614
 4.1.  http_connect(connection, url, [content_type, data,] result)
615 615
 
... ...
@@ -667,7 +667,7 @@ modparam("http_client", "httpredirect", 1);
667 667
 http_get_redirect("apiserver", "$var(targeturl)");
668 668
 ...
669 669
 
670
-4.3.  http_client_query(url, [post-data], result)
670
+4.3.  http_client_query(url, [post-data], [hdrs], result)
671 671
 
672 672
    Sends HTTP GET or POST request according to URL given in “url”
673 673
    parameter, which is a string that may contain pseudo variables.
... ...
@@ -675,6 +675,12 @@ http_get_redirect("apiserver", "$var(targeturl)");
675 675
    If you want to make a POST-Request, you have to define the “post”-data,
676 676
    that should be submitted in that request as the second parameter.
677 677
 
678
+   Custom headers may be specified via “hdrs” parameter (e.g.,
679
+   Content-Type).
680
+
681
+   Either of “post-data” or “hdrs” can be also set to empty string in
682
+   order to be ignored.
683
+
678 684
    If HTTP server returns a class 2xx, 3xx or 4xx reply, the first line of
679 685
    the reply's body (if any) is stored in “result” parameter, which must
680 686
    be a writable pseudo variable.
... ...
@@ -689,25 +695,26 @@ http_get_redirect("apiserver", "$var(targeturl)");
689 695
    utils module. It is changed to use the same base library and settings
690 696
    as the rest of the functions in this module.
691 697
 
692
-   Example 1.21. curl_http_query() usage
698
+   Example 1.21. http_client_query() usage
693 699
 ...
694 700
 # GET-Request
695 701
 http_client_query("http://api.com/index.php?r_uri=$(ru{s.escape.param})&f_uri=$(
696 702
 fu{s.escape.param})",
697 703
            "$var(result)");
698
-switch ($retcode) {
699
-       ...
704
+switch ($rc) {
705
+    ...
700 706
 }
701 707
 ...
702
-...
703 708
 # POST-Request
704
-http_client_query("http://api.com/index.php", "r_uri=$(ru{s.escape.param})&f_uri
705
-=$(fu{s.escape.param})",
706
-           "$var(result)");
707
-switch ($retcode) {
708
-       ...
709
+http_client_query("http://api.com/index.php",
710
+    "r_uri=$(ru{s.escape.param})&f_uri=$(fu{s.escape.param})",
711
+    "$var(result)");
709 712
 }
710 713
 ...
714
+# POST-Request
715
+http_client_query("http://api.com/index.php", "src=$si",
716
+    "Content-Type: text/plain", "$var(result)");
717
+...
711 718
 
712 719
 5. Pseudovariables
713 720
 
Browse code

modules: readme files regenerated - acc ...

Kamailio Dev authored on 02/01/2017 16:31:15
Showing 1 changed files
... ...
@@ -85,14 +85,15 @@ Hugh Waite
85 85
 
86 86
    2. Developer Guide
87 87
 
88
-        1. Available Functions
88
+        1.
89
+        2. Available Functions
89 90
 
90
-              1.1. http_connect(msg, connection, url, result,
91
+              2.1. int http_connect(msg, connection, url, result,
91 92
                       content_type, post)
92 93
 
93
-              1.2. int http_connection_exists(str *connection)
94
-              1.3. http_query(msg, url, dest, post)
95
-              1.4. http_get_content_type(str connection)
94
+              2.2. int http_connection_exists(str *connection)
95
+              2.3. int http_query(msg, url, dest, post)
96
+              2.4. http_get_content_type(str connection)
96 97
 
97 98
    List of Examples
98 99
 
... ...
@@ -175,7 +176,8 @@ Chapter 1. Admin Guide
175 176
    This module implements protocol functions that use the libcurl library
176 177
    to fetch data from external HTTP servers or post data to HTTP servers.
177 178
    The module is using a concept of "connections" to define properties of
178
-   HTTP sessions in a simple way.
179
+   HTTP sessions in a simple way. A connection has one or multiple servers
180
+   and a set of settings that apply to the specific connection.
179 181
 
180 182
    The http_client module has multiple settings, some of them applies to a
181 183
    defined connection. You can set timeouts, max data sizes for download
... ...
@@ -191,9 +193,10 @@ Chapter 1. Admin Guide
191 193
    Transformation Cookbook (as used in the http_client_query example
192 194
    below).
193 195
 
194
-   Function http_client_query allows Kamailio to issue an HTTP GET request
195
-   and get access to parts of the reply. This function has been ported
196
-   from the utils module and now use the same libcurl functions.
196
+   The function http_client_query allows Kamailio to issue an HTTP GET
197
+   request and get access to parts of the reply. This function has been
198
+   ported from the utils module and now use the same libcurl functions. We
199
+   recommend using the new functionality provided by this module.
197 200
 
198 201
    The http_client module use the CURL library setting up connections. The
199 202
    CURL library by default use the system configured DNS resolvers, not
... ...
@@ -760,23 +763,28 @@ Chapter 2. Developer Guide
760 763
 
761 764
    Table of Contents
762 765
 
763
-   1. Available Functions
766
+   1.
767
+   2. Available Functions
764 768
 
765
-        1.1. http_connect(msg, connection, url, result, content_type,
769
+        2.1. int http_connect(msg, connection, url, result, content_type,
766 770
                 post)
767 771
 
768
-        1.2. int http_connection_exists(str *connection)
769
-        1.3. http_query(msg, url, dest, post)
770
-        1.4. http_get_content_type(str connection)
772
+        2.2. int http_connection_exists(str *connection)
773
+        2.3. int http_query(msg, url, dest, post)
774
+        2.4. http_get_content_type(str connection)
771 775
 
772
-1. Available Functions
776
+   This module provides a set of API functions that other modules can use
777
+   in order to integrate with HTTP services.
773 778
 
774
-   1.1. http_connect(msg, connection, url, result, content_type, post)
775
-   1.2. int http_connection_exists(str *connection)
776
-   1.3. http_query(msg, url, dest, post)
777
-   1.4. http_get_content_type(str connection)
779
+2. Available Functions
778 780
 
779
-1.1.  http_connect(msg, connection, url, result, content_type, post)
781
+   2.1. int http_connect(msg, connection, url, result, content_type, post)
782
+
783
+   2.2. int http_connection_exists(str *connection)
784
+   2.3. int http_query(msg, url, dest, post)
785
+   2.4. http_get_content_type(str connection)
786
+
787
+2.1.  int http_connect(msg, connection, url, result, content_type, post)
780 788
 
781 789
    Sends HTTP GET or POST request to a given connection. If content_type
782 790
    and post are NULL GET will be used. If post is not null the data will
... ...
@@ -805,7 +813,7 @@ Chapter 2. Developer Guide
805 813
        A string containing the message body to send. Use NULL when a
806 814
        message body is not required.
807 815
 
808
-1.2.  int http_connection_exists(str *connection)
816
+2.2.  int http_connection_exists(str *connection)
809 817
 
810 818
    Check if a connection definition exists. Connections are defined as
811 819
    modparam's in the http_client modules.
... ...
@@ -813,16 +821,16 @@ Chapter 2. Developer Guide
813 821
    Returns 1 if the connection exists, 0 if a connection with the given
814 822
    name can't be found.
815 823
 
816
-1.3.  http_query(msg, url, dest, post)
824
+2.3.  int http_query(msg, url, dest, post)
817 825
 
818
-   Sends HTTP GET or POST request to a given connection. If post data is
826
+   Sends a HTTP GET or POST request to a given connection. If post data is
819 827
    defined, POST will be used, otherwise GET. The default settings defined
820 828
    as module params of the http_client module will be used for the
821 829
    connection.
822 830
 
823 831
    Meaning of the parameters is as follows:
824 832
      * struct sip_msg *msg
825
-       The current sip message structure.
833
+       The current SIP message structure.
826 834
      * const char *url
827 835
        A string that will be used as the URL specified in the connection.
828 836
      * str *dest
... ...
@@ -832,7 +840,7 @@ Chapter 2. Developer Guide
832 840
      * const char *post
833 841
        If not null, the data will be posted to the URL.
834 842
 
835
-1.4.  http_get_content_type(str connection)
843
+2.4.  http_get_content_type(str connection)
836 844
 
837 845
    Get the content-type of the last result for this connection. This will
838 846
    be something like "text/html" for html or "application/json" for JSON
Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,844 @@
1
+http_client
2
+
3
+Olle E. Johansson
4
+
5
+   Edvina AB
6
+   <oej@edvina.net>
7
+
8
+Juha Heinanen
9
+
10
+   TutPro Inc.
11
+   <jh@tutpro.com>
12
+
13
+Carsten Bock
14
+
15
+   ng-voice GmbH
16
+   <carsten@ng-voice.com>
17
+
18
+Hugh Waite
19
+
20
+   Xura Inc
21
+   <hugh.waite@xura.com>
22
+
23
+   Copyright © 2008-2009 Juha Heinanen
24
+
25
+   Copyright © 2013 Carsten Bock, ng-voice GmbH
26
+
27
+   Copyright © 2015 Olle E. Johansson, Edvina AB
28
+
29
+   Copyright © 2016 Hugh Waite, Xura Inc
30
+     __________________________________________________________________
31
+
32
+   Table of Contents
33
+
34
+   1. Admin Guide
35
+
36
+        1. Overview
37
+        2. Dependencies
38
+
39
+              2.1. Kamailio Modules
40
+              2.2. External Libraries or Applications
41
+
42
+        3. Parameters
43
+
44
+              3.1. httpredirect (int)
45
+              3.2. httpproxy (string)
46
+              3.3. httpproxyport (string)
47
+              3.4. useragent (string)
48
+              3.5. maxdatasize (int)
49
+              3.6. connection_timeout (int)
50
+              3.7. client_cert (string)
51
+              3.8. client_key (string)
52
+              3.9. cacert (string)
53
+              3.10. cipher_suites (string)
54
+              3.11. verify_peer (int)
55
+              3.12. verify_host (int)
56
+              3.13. tlsversion (int)
57
+              3.14. authmethod (int)
58
+              3.15. keep_connections (int)
59
+              3.16. httpcon (string)
60
+              3.17. config_file (string)
61
+
62
+        4. Functions
63
+
64
+              4.1. http_connect(connection, url, [content_type, data,]
65
+                      result)
66
+
67
+              4.2. http_get_redirect(connection, result)
68
+              4.3. http_client_query(url, [post-data], result)
69
+
70
+        5. Pseudovariables
71
+
72
+              5.1. $curlerror(error)
73
+
74
+        6. RPC Commands
75
+
76
+              6.1. httpclient.listcon
77
+
78
+        7. Counters
79
+
80
+              7.1. httpclient.connections
81
+              7.2. httpclient.connok
82
+              7.3. httpclient.connfail
83
+
84
+        8. Remarks
85
+
86
+   2. Developer Guide
87
+
88
+        1. Available Functions
89
+
90
+              1.1. http_connect(msg, connection, url, result,
91
+                      content_type, post)
92
+
93
+              1.2. int http_connection_exists(str *connection)
94
+              1.3. http_query(msg, url, dest, post)
95
+              1.4. http_get_content_type(str connection)
96
+
97
+   List of Examples
98
+
99
+   1.1. Set httpredirect parameter
100
+   1.2. Set httpproxy parameter
101
+   1.3. Set httpproxyport parameter
102
+   1.4. Set useragent parameter
103
+   1.5. Set maxdatasize parameter
104
+   1.6. Set connection_timeout parameter
105
+   1.7. Set client_cert parameter
106
+   1.8. Set client_key parameter
107
+   1.9. Set cacert parameter
108
+   1.10. Set cipher_suites parameter
109
+   1.11. Set verify_peer parameter
110
+   1.12. Set verify_host parameter
111
+   1.13. Set tlsversion parameter
112
+   1.14. Set authmethod parameter
113
+   1.15. Set keep_connections parameter
114
+   1.16. Set httpcon parameter
115
+   1.17. Set config_file parameter
116
+   1.18. Short http_client config file
117
+   1.19. http_connect() usage
118
+   1.20. http_get_redirect() usage
119
+   1.21. curl_http_query() usage
120
+
121
+Chapter 1. Admin Guide
122
+
123
+   Table of Contents
124
+
125
+   1. Overview
126
+   2. Dependencies
127
+
128
+        2.1. Kamailio Modules
129
+        2.2. External Libraries or Applications
130
+
131
+   3. Parameters
132
+
133
+        3.1. httpredirect (int)
134
+        3.2. httpproxy (string)