diff options
author | Sven Nierlein <sven@nierlein.de> | 2017-05-28 10:11:15 +0200 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.de> | 2018-10-22 16:30:31 +0200 |
commit | 787e6986eea096c644c09eefa1b66a4156b32b45 (patch) | |
tree | 4eadec81e2a349d8e754de97fb0b634c3c413f67 /plugins/check_curl.c | |
parent | 7eb43858db118b89d13eb71bf07b2c110edb258b (diff) | |
download | monitoring-plugins-787e6986eea096c644c09eefa1b66a4156b32b45.tar.gz |
check_curl: handle proxied https requests
Diffstat (limited to 'plugins/check_curl.c')
-rw-r--r-- | plugins/check_curl.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 6856e781..0f065731 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c | |||
@@ -371,8 +371,19 @@ check_http (void) | |||
371 | } | 371 | } |
372 | #endif /* LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 21, 3) */ | 372 | #endif /* LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 21, 3) */ |
373 | 373 | ||
374 | /* set port */ | 374 | /* extract proxy information for legacy proxy https requests */ |
375 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_PORT, server_port), "CURLOPT_PORT"); | 375 | if (!strcmp(http_method, "CONNECT")) { |
376 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_PROXY, server_address), "CURLOPT_PROXY"); | ||
377 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_PROXYPORT, (long)server_port), "CURLOPT_PROXYPORT"); | ||
378 | if (verbose>=2) | ||
379 | printf ("* curl CURLOPT_PROXY: %s:%d\n", server_address, server_port); | ||
380 | http_method = "GET"; | ||
381 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_URL, server_url), "CURLOPT_URL"); | ||
382 | //server_port = use_ssl ? HTTPS_PORT : HTTP_PORT; | ||
383 | } else { | ||
384 | /* set port */ | ||
385 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_PORT, server_port), "CURLOPT_PORT"); | ||
386 | } | ||
376 | 387 | ||
377 | /* set HTTP method */ | 388 | /* set HTTP method */ |
378 | if (http_method) { | 389 | if (http_method) { |