diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/check_curl.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 8f9a21d2..fbb197f7 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c | |||
| @@ -223,6 +223,7 @@ curlhelp_ssl_library ssl_library = CURLHELP_SSL_LIBRARY_UNKNOWN; | |||
| 223 | int curl_http_version = CURL_HTTP_VERSION_NONE; | 223 | int curl_http_version = CURL_HTTP_VERSION_NONE; |
| 224 | bool automatic_decompression = false; | 224 | bool automatic_decompression = false; |
| 225 | char *cookie_jar_file = NULL; | 225 | char *cookie_jar_file = NULL; |
| 226 | bool haproxy_protocol = false; | ||
| 226 | 227 | ||
| 227 | bool process_arguments (int, char**); | 228 | bool process_arguments (int, char**); |
| 228 | void handle_curl_option_return_code (CURLcode res, const char* option); | 229 | void handle_curl_option_return_code (CURLcode res, const char* option); |
| @@ -520,6 +521,11 @@ check_http (void) | |||
| 520 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_CONNECTTIMEOUT, socket_timeout), "CURLOPT_CONNECTTIMEOUT"); | 521 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_CONNECTTIMEOUT, socket_timeout), "CURLOPT_CONNECTTIMEOUT"); |
| 521 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_TIMEOUT, socket_timeout), "CURLOPT_TIMEOUT"); | 522 | handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_TIMEOUT, socket_timeout), "CURLOPT_TIMEOUT"); |
| 522 | 523 | ||
| 524 | /* enable haproxy protocol */ | ||
| 525 | if (haproxy_protocol) { | ||
| 526 | handle_curl_option_return_code(curl_easy_setopt(curl, CURLOPT_HAPROXYPROTOCOL, 1L), "CURLOPT_HAPROXYPROTOCOL"); | ||
| 527 | } | ||
| 528 | |||
| 523 | // 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 | 529 | // 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 |
| 524 | if(use_ssl && host_name != NULL) { | 530 | if(use_ssl && host_name != NULL) { |
| 525 | if ( (res=lookup_host (server_address, addrstr, DEFAULT_BUFFER_SIZE/2)) != 0) { | 531 | if ( (res=lookup_host (server_address, addrstr, DEFAULT_BUFFER_SIZE/2)) != 0) { |
| @@ -1384,7 +1390,8 @@ process_arguments (int argc, char **argv) | |||
| 1384 | CA_CERT_OPTION, | 1390 | CA_CERT_OPTION, |
| 1385 | HTTP_VERSION_OPTION, | 1391 | HTTP_VERSION_OPTION, |
| 1386 | AUTOMATIC_DECOMPRESSION, | 1392 | AUTOMATIC_DECOMPRESSION, |
| 1387 | COOKIE_JAR | 1393 | COOKIE_JAR, |
| 1394 | HAPROXY_PROTOCOL | ||
| 1388 | }; | 1395 | }; |
| 1389 | 1396 | ||
| 1390 | int option = 0; | 1397 | int option = 0; |
| @@ -1431,6 +1438,7 @@ process_arguments (int argc, char **argv) | |||
| 1431 | {"http-version", required_argument, 0, HTTP_VERSION_OPTION}, | 1438 | {"http-version", required_argument, 0, HTTP_VERSION_OPTION}, |
| 1432 | {"enable-automatic-decompression", no_argument, 0, AUTOMATIC_DECOMPRESSION}, | 1439 | {"enable-automatic-decompression", no_argument, 0, AUTOMATIC_DECOMPRESSION}, |
| 1433 | {"cookie-jar", required_argument, 0, COOKIE_JAR}, | 1440 | {"cookie-jar", required_argument, 0, COOKIE_JAR}, |
| 1441 | {"haproxy-protocol", no_argument, 0, HAPROXY_PROTOCOL}, | ||
| 1434 | {0, 0, 0, 0} | 1442 | {0, 0, 0, 0} |
| 1435 | }; | 1443 | }; |
| 1436 | 1444 | ||
| @@ -1841,6 +1849,9 @@ process_arguments (int argc, char **argv) | |||
| 1841 | case COOKIE_JAR: | 1849 | case COOKIE_JAR: |
| 1842 | cookie_jar_file = optarg; | 1850 | cookie_jar_file = optarg; |
| 1843 | break; | 1851 | break; |
| 1852 | case HAPROXY_PROTOCOL: | ||
| 1853 | haproxy_protocol = true; | ||
| 1854 | break; | ||
| 1844 | case '?': | 1855 | case '?': |
| 1845 | /* print short usage statement if args not parsable */ | 1856 | /* print short usage statement if args not parsable */ |
| 1846 | usage5 (); | 1857 | usage5 (); |
| @@ -2060,6 +2071,8 @@ print_help (void) | |||
| 2060 | printf (" %s\n", _("1.0 = HTTP/1.0, 1.1 = HTTP/1.1, 2.0 = HTTP/2 (HTTP/2 will fail without -S)")); | 2071 | printf (" %s\n", _("1.0 = HTTP/1.0, 1.1 = HTTP/1.1, 2.0 = HTTP/2 (HTTP/2 will fail without -S)")); |
| 2061 | printf (" %s\n", "--enable-automatic-decompression"); | 2072 | printf (" %s\n", "--enable-automatic-decompression"); |
| 2062 | printf (" %s\n", _("Enable automatic decompression of body (CURLOPT_ACCEPT_ENCODING).")); | 2073 | printf (" %s\n", _("Enable automatic decompression of body (CURLOPT_ACCEPT_ENCODING).")); |
| 2074 | printf(" %s\n", "--haproxy-protocol"); | ||
| 2075 | printf(" %s\n", _("Send HAProxy proxy protocol v1 header (CURLOPT_HAPROXYPROTOCOL).")); | ||
| 2063 | printf (" %s\n", "---cookie-jar=FILE"); | 2076 | printf (" %s\n", "---cookie-jar=FILE"); |
| 2064 | printf (" %s\n", _("Store cookies in the cookie jar and send them out when requested.")); | 2077 | printf (" %s\n", _("Store cookies in the cookie jar and send them out when requested.")); |
| 2065 | printf ("\n"); | 2078 | printf ("\n"); |
| @@ -2144,7 +2157,7 @@ print_usage (void) | |||
| 2144 | printf (" [-b proxy_auth] [-f <ok|warning|critical|follow|sticky|stickyport|curl>]\n"); | 2157 | printf (" [-b proxy_auth] [-f <ok|warning|critical|follow|sticky|stickyport|curl>]\n"); |
| 2145 | printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); | 2158 | printf (" [-e <expect>] [-d string] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n"); |
| 2146 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); | 2159 | printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n"); |
| 2147 | printf (" [-A string] [-k string] [-S <version>] [--sni]\n"); | 2160 | printf (" [-A string] [-k string] [-S <version>] [--sni] [--haproxy-protocol]\n"); |
| 2148 | printf (" [-T <content-type>] [-j method]\n"); | 2161 | printf (" [-T <content-type>] [-j method]\n"); |
| 2149 | printf (" [--http-version=<version>] [--enable-automatic-decompression]\n"); | 2162 | printf (" [--http-version=<version>] [--enable-automatic-decompression]\n"); |
| 2150 | printf (" [--cookie-jar=<cookie jar file>\n"); | 2163 | printf (" [--cookie-jar=<cookie jar file>\n"); |
