diff --git a/modules/http_client/README b/modules/http_client/README index 0d766584032..e75ecbd6438 100644 --- a/modules/http_client/README +++ b/modules/http_client/README @@ -59,7 +59,8 @@ Hugh Waite 4.1. http_connect(connection, url, [content_type, data,] result) - 4.2. http_client_query(url, [post-data], result) + 4.2. http_get_redirect(connection, result) + 4.3. http_client_query(url, [post-data], result) 5. Pseudovariables @@ -102,7 +103,8 @@ Hugh Waite 1.16. Set config_file parameter 1.17. Short http_client config file 1.18. http_connect() usage - 1.19. curl_http_query() usage + 1.19. http_get_redirect() usage + 1.20. curl_http_query() usage Chapter 1. Admin Guide @@ -136,7 +138,8 @@ Chapter 1. Admin Guide 4. Functions 4.1. http_connect(connection, url, [content_type, data,] result) - 4.2. http_client_query(url, [post-data], result) + 4.2. http_get_redirect(connection, result) + 4.3. http_client_query(url, [post-data], result) 5. Pseudovariables @@ -556,7 +559,8 @@ http_follow_redirect = no 4. Functions 4.1. http_connect(connection, url, [content_type, data,] result) - 4.2. http_client_query(url, [post-data], result) + 4.2. http_get_redirect(connection, result) + 4.3. http_client_query(url, [post-data], result) 4.1. http_connect(connection, url, [content_type, data,] result) @@ -596,7 +600,25 @@ xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n" ); ... -4.2. http_client_query(url, [post-data], result) +4.2. http_get_redirect(connection, result) + + When a http connection gets a redirect and the connection is configured + to follow redirects (301,302) then the target URL, the result of the + redirects can be retrieved with this function after a successful + connection. + * connection - the name of an existing HTTP connection, definied by a + httpcon modparam. + result - The name of a pseudo variable that will contain the last + used URL. + + Example 1.19. http_get_redirect() usage +... +modparam("http_client", "httpredirect", 1); +... +http_get_redirect("apiserver", "$var(targeturl)"); +... + +4.3. http_client_query(url, [post-data], result) Sends HTTP GET or POST request according to URL given in "url" parameter, which is a string that may contain pseudo variables. @@ -618,7 +640,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 as the rest of the functions in this module. - Example 1.19. curl_http_query() usage + Example 1.20. curl_http_query() usage ... # GET-Request http_client_query("http://tutpro.com/index.php?r_uri=$(ru{s.escape.param})&f_uri diff --git a/modules/http_client/doc/http_client_admin.xml b/modules/http_client/doc/http_client_admin.xml index 800b97e3bb0..72a7a53bb89 100644 --- a/modules/http_client/doc/http_client_admin.xml +++ b/modules/http_client/doc/http_client_admin.xml @@ -633,6 +633,38 @@ xlog("L_INFO", "API-server HTTP connection: $avp(gurka) Result code $var(res)\n" $var(res) = http_connect("apiserver", "/callroute", "application/json", "$var(jsondata)", "$avp(route)"); xlog("L_INFO", "API-server HTTP connection: $avp(route) Result code $var(res)\n"); +... + + + +
+ + <function moreinfo="none">http_get_redirect(connection, result)</function> + + + When a http connection gets a redirect and the connection is configured to follow + redirects (301,302) then the target URL, the result of the redirects can be + retrieved with this function after a successful connection. + + + + + connection - the name of an existing + HTTP connection, definied by a httpcon modparam. + + + result - The name of a pseudo variable that + will contain the last used URL. + + + + + <function>http_get_redirect()</function> usage + +... +modparam("http_client", "httpredirect", 1); +... +http_get_redirect("apiserver", "$var(targeturl)"); ...