diff options
-rw-r--r-- | plugins/check_curl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 2b0e378..2d69b31 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c | |||
@@ -127,8 +127,8 @@ int cflags = REG_NOSUB | REG_EXTENDED | REG_NEWLINE; | |||
127 | int errcode; | 127 | int errcode; |
128 | int invert_regex = 0; | 128 | int invert_regex = 0; |
129 | 129 | ||
130 | char *server_address; | 130 | char *server_address = NULL; |
131 | char *host_name; | 131 | char *host_name = NULL; |
132 | char *server_url = 0; | 132 | char *server_url = 0; |
133 | char server_ip[DEFAULT_BUFFER_SIZE]; | 133 | char server_ip[DEFAULT_BUFFER_SIZE]; |
134 | struct curl_slist *server_ips = NULL; | 134 | struct curl_slist *server_ips = NULL; |
@@ -367,7 +367,7 @@ check_http (void) | |||
367 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_TIMEOUT, socket_timeout), "CURLOPT_TIMEOUT"); | 367 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_TIMEOUT, socket_timeout), "CURLOPT_TIMEOUT"); |
368 | 368 | ||
369 | // fill dns resolve cache to make curl connect to the given server_address instead of the host_name, only required for ssl, because we use the host_name later on to make SNI happy | 369 | // fill dns resolve cache to make curl connect to the given server_address instead of the host_name, only required for ssl, because we use the host_name later on to make SNI happy |
370 | if(use_ssl) { | 370 | if(use_ssl && host_name != NULL) { |
371 | struct curl_slist *host = NULL; | 371 | struct curl_slist *host = NULL; |
372 | char dnscache[DEFAULT_BUFFER_SIZE]; | 372 | char dnscache[DEFAULT_BUFFER_SIZE]; |
373 | snprintf (dnscache, DEFAULT_BUFFER_SIZE, "%s:%d:%s", host_name, server_port, server_address); | 373 | snprintf (dnscache, DEFAULT_BUFFER_SIZE, "%s:%d:%s", host_name, server_port, server_address); |
@@ -380,7 +380,7 @@ check_http (void) | |||
380 | /* compose URL: use the address we want to connect to, set Host: header later */ | 380 | /* compose URL: use the address we want to connect to, set Host: header later */ |
381 | snprintf (url, DEFAULT_BUFFER_SIZE, "%s://%s:%d%s", | 381 | snprintf (url, DEFAULT_BUFFER_SIZE, "%s://%s:%d%s", |
382 | use_ssl ? "https" : "http", | 382 | use_ssl ? "https" : "http", |
383 | use_ssl ? host_name : server_address, | 383 | use_ssl & host_name != NULL ? host_name : server_address, |
384 | server_port, | 384 | server_port, |
385 | server_url | 385 | server_url |
386 | ); | 386 | ); |