aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml3
-rw-r--r--configure.ac1
-rw-r--r--plugins/check_curl.c22
3 files changed, 14 insertions, 12 deletions
diff --git a/.travis.yml b/.travis.yml
index 617c4154..b8249aa7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,7 +20,7 @@ matrix:
name: "monitoring-plugins/monitoring-plugins"
description: "Monitoring Plugins"
notification_email: team@monitoring-plugins.org
- build_command_prepend: tools/setup && ./configure
+ build_command_prepend: tools/setup && ./configure --enable-check-curl
build_command: make
branch_pattern: coverity.*
- compiler: "clang"
@@ -55,6 +55,7 @@ install:
- sudo apt-get install -qq --no-install-recommends autoconf automake
- sudo apt-get install -qq --no-install-recommends faketime
- sudo apt-get install -qq --no-install-recommends libmonitoring-plugin-perl
+ - sudo apt-get install -qq --no-install-recommends libcurl3-gnutls-dev
# Trusty related dependencies (not yet provided)
- test "$(dpkg -l | grep -E "mysql-(client|server)-[0-9].[0-9]" | grep -c ^ii)" -gt 0 || sudo apt-get install -qq --no-install-recommends mariadb-client mariadb-server
# enable ssl apache
diff --git a/configure.ac b/configure.ac
index c56163c1..2291c51b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1908,5 +1908,6 @@ ACX_FEATURE([enable],[perl-modules])
ACX_FEATURE([with],[cgiurl])
ACX_FEATURE([with],[trusted-path])
ACX_FEATURE([enable],[libtap])
+ACX_FEATURE([enable],[check-curl])
ACX_FEATURE([with],[libcurl])
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 72db27ad..3ae1c4d0 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -551,7 +551,7 @@ check_http (void)
CURLINFO_REDIRECT_COUNT: get the number of redirects, print it, maybe a range option here is nice like for expected page size?
*/
} else {
- // old style redirection is handled below
+ /* old style redirection is handled below */
}
}
@@ -1019,6 +1019,8 @@ redir (curlhelp_write_curlbuf* header_buf)
new_host = strdup (uri_string (uri.hostText, buf, DEFAULT_BUFFER_SIZE));
}
+ /* compose new path */
+ /* TODO: handle fragments and query part of URL */
new_url = (char *)calloc( 1, DEFAULT_BUFFER_SIZE);
if (uri.pathHead) {
const UriPathSegmentA* p = uri.pathHead;
@@ -1038,23 +1040,21 @@ redir (curlhelp_write_curlbuf* header_buf)
/* set new values for redirected request */
- free (host_name);
- host_name = strndup (new_host, MAX_IPV4_HOSTLENGTH);
- free(new_host);
-
- server_port = (unsigned short)new_port;
-
- /* reset virtual port */
- virtual_port = server_port;
-
if (!(followsticky & STICKY_HOST)) {
free (server_address);
server_address = strndup (new_host, MAX_IPV4_HOSTLENGTH);
}
if (!(followsticky & STICKY_PORT)) {
- server_port = new_port;
+ server_port = (unsigned short)new_port;
}
+ free (host_name);
+ host_name = strndup (new_host, MAX_IPV4_HOSTLENGTH);
+
+ /* reset virtual port */
+ virtual_port = server_port;
+
+ free(new_host);
free (server_url);
server_url = new_url;