diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2004-02-20 03:21:40 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2004-02-20 03:21:40 +0000 |
commit | 15e5ea295c05f0e609de4c744ffacf4440dfee9b (patch) | |
tree | 6ba1baecfcef31d8628dc123990a03438b3b91fb /plugins/check_http.c | |
parent | 55f8f712fb2808ff9e4c478d75aaf7895aa55c84 (diff) | |
download | monitoring-plugins-15e5ea295c05f0e609de4c744ffacf4440dfee9b.tar.gz |
Added Content-type when POSTing (Shawn Wills)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@813 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_http.c')
-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 8e45e88d..afd75d3d 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -111,6 +111,7 @@ int redir_depth = 0; int max_depth = 15; char *http_method; char *http_post_data; +char *http_content_type; char buffer[MAX_INPUT_BUFFER]; int process_arguments (int, char **); @@ -207,6 +208,7 @@ process_arguments (int argc, char **argv) {"linespan", no_argument, 0, 'l'}, {"onredirect", required_argument, 0, 'f'}, {"certificate", required_argument, 0, 'C'}, + {"content-type", required_argument, 0, 'T'}, {"min", required_argument, 0, 'm'}, {"use-ipv4", no_argument, 0, '4'}, {"use-ipv6", no_argument, 0, '6'}, @@ -345,6 +347,9 @@ process_arguments (int argc, char **argv) server_expect[MAX_INPUT_BUFFER - 1] = 0; server_expect_yn = 1; break; + case 'T': /* Content-type */ + asprintf (&http_content_type, "%s", optarg); + break; #ifndef HAVE_REGEX_H case 'l': /* linespan */ case 'r': /* linespan */ @@ -519,7 +524,11 @@ check_http (void) /* either send http POST data */ if (http_post_data) { - asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); + if (http_content_type) { + asprintf (&buf, "%sContent-Type: %s\r\n", buf, http_content_type); + } else { + asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); + } asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, strlen (http_post_data)); asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); } @@ -1143,7 +1152,9 @@ certificate expiration times.\n")); -u, --url=PATH\n\ URL to GET or POST (default: /)\n\ -P, --post=STRING\n\ - URL encoded http POST data\n"), HTTP_EXPECT); + URL encoded http POST data\n\ + -T, --content-type=STRING\n\ + specify Content-Type header media type when POSTing\n"), HTTP_EXPECT); #ifdef HAVE_REGEX_H printf (_("\ |