diff options
-rw-r--r-- | plugins/check_http.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index 8e45e88..afd75d3 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -111,6 +111,7 @@ int redir_depth = 0; | |||
111 | int max_depth = 15; | 111 | int max_depth = 15; |
112 | char *http_method; | 112 | char *http_method; |
113 | char *http_post_data; | 113 | char *http_post_data; |
114 | char *http_content_type; | ||
114 | char buffer[MAX_INPUT_BUFFER]; | 115 | char buffer[MAX_INPUT_BUFFER]; |
115 | 116 | ||
116 | int process_arguments (int, char **); | 117 | int process_arguments (int, char **); |
@@ -207,6 +208,7 @@ process_arguments (int argc, char **argv) | |||
207 | {"linespan", no_argument, 0, 'l'}, | 208 | {"linespan", no_argument, 0, 'l'}, |
208 | {"onredirect", required_argument, 0, 'f'}, | 209 | {"onredirect", required_argument, 0, 'f'}, |
209 | {"certificate", required_argument, 0, 'C'}, | 210 | {"certificate", required_argument, 0, 'C'}, |
211 | {"content-type", required_argument, 0, 'T'}, | ||
210 | {"min", required_argument, 0, 'm'}, | 212 | {"min", required_argument, 0, 'm'}, |
211 | {"use-ipv4", no_argument, 0, '4'}, | 213 | {"use-ipv4", no_argument, 0, '4'}, |
212 | {"use-ipv6", no_argument, 0, '6'}, | 214 | {"use-ipv6", no_argument, 0, '6'}, |
@@ -345,6 +347,9 @@ process_arguments (int argc, char **argv) | |||
345 | server_expect[MAX_INPUT_BUFFER - 1] = 0; | 347 | server_expect[MAX_INPUT_BUFFER - 1] = 0; |
346 | server_expect_yn = 1; | 348 | server_expect_yn = 1; |
347 | break; | 349 | break; |
350 | case 'T': /* Content-type */ | ||
351 | asprintf (&http_content_type, "%s", optarg); | ||
352 | break; | ||
348 | #ifndef HAVE_REGEX_H | 353 | #ifndef HAVE_REGEX_H |
349 | case 'l': /* linespan */ | 354 | case 'l': /* linespan */ |
350 | case 'r': /* linespan */ | 355 | case 'r': /* linespan */ |
@@ -519,7 +524,11 @@ check_http (void) | |||
519 | 524 | ||
520 | /* either send http POST data */ | 525 | /* either send http POST data */ |
521 | if (http_post_data) { | 526 | if (http_post_data) { |
522 | asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); | 527 | if (http_content_type) { |
528 | asprintf (&buf, "%sContent-Type: %s\r\n", buf, http_content_type); | ||
529 | } else { | ||
530 | asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); | ||
531 | } | ||
523 | asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, strlen (http_post_data)); | 532 | asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, strlen (http_post_data)); |
524 | asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); | 533 | asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); |
525 | } | 534 | } |
@@ -1143,7 +1152,9 @@ certificate expiration times.\n")); | |||
1143 | -u, --url=PATH\n\ | 1152 | -u, --url=PATH\n\ |
1144 | URL to GET or POST (default: /)\n\ | 1153 | URL to GET or POST (default: /)\n\ |
1145 | -P, --post=STRING\n\ | 1154 | -P, --post=STRING\n\ |
1146 | URL encoded http POST data\n"), HTTP_EXPECT); | 1155 | URL encoded http POST data\n\ |
1156 | -T, --content-type=STRING\n\ | ||
1157 | specify Content-Type header media type when POSTing\n"), HTTP_EXPECT); | ||
1147 | 1158 | ||
1148 | #ifdef HAVE_REGEX_H | 1159 | #ifdef HAVE_REGEX_H |
1149 | printf (_("\ | 1160 | printf (_("\ |