summaryrefslogtreecommitdiffstats
path: root/web/attachments/49410-nagios-check_http-header-patch.txt
blob: c2d9556b0f2efacc12c2ee14596dbe686b6bf3a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
--- check_http.c	2003-05-02 18:28:50.000000000 -0500
+++ check_http_orig.c	2003-02-22 01:22:02.000000000 -0600
@@ -41,7 +41,7 @@
 certificate expiration times.\n"
 
 #define OPTIONS "\
-(-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>] [-E header]\n\
+(-H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\
             [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\
             [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
             [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\
@@ -61,8 +61,6 @@
    URL to GET or POST (default: /)\n\
  -p, --port=INTEGER\n\
    Port number (default: %d)\n\
- -E, --extra-header=HEADER\n\
-   Extra HTTP header (name: value)\n\
  -P, --post=STRING\n\
    URL encoded http POST data\n\
  -w, --warning=INTEGER\n\
@@ -222,7 +220,6 @@
 int sd;
 char *http_method = "GET";
 char *http_post_data = "";
-char *http_extra_headers = NULL;
 char buffer[MAX_INPUT_BUFFER];
 
 void print_usage (void);
@@ -305,7 +302,6 @@
 		{"nohtml", no_argument, 0, 'n'},
 		{"ssl", no_argument, 0, 'S'},
 		{"verbose", no_argument, 0, 'v'},
-		{"extra-header", required_argument, 0, 'E'},
 		{"post", required_argument, 0, 'P'},
 		{"IP-address", required_argument, 0, 'I'},
 		{"string", required_argument, 0, 's'},
@@ -335,7 +331,7 @@
 			strcpy (argv[c], "-n");
 	}
 
-#define OPTCHARS "Vvht:c:w:H:E:P:I:a:e:p:s:R:r:u:f:C:nlLS"
+#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLS"
 
 	while (1) {
 #ifdef HAVE_GETOPT_H
@@ -434,17 +430,6 @@
 			strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1);
 			user_auth[MAX_INPUT_BUFFER - 1] = 0;
 			break;
-		case 'E': /* extra HTTP header as name: value */
-		  if (strstr (optarg, ": ") == NULL)
-				usage2 ("invalid HTTP header syntax: should be of the form 'name: value'", optarg);
-			if (http_extra_headers == NULL) {
-				asprintf (&http_extra_headers, "%s\r\n", optarg);
-			} else {
-				char *old_headers = http_extra_headers;
-				asprintf (&http_extra_headers, "%s%s\r\n", old_headers, optarg);
-				free (old_headers);
-			}
-			break;
 		case 'P': /* HTTP POST data in URL encoded format */
 			asprintf (&http_method, "%s", "POST");
 			asprintf (&http_post_data, "%s", optarg);
@@ -610,11 +595,6 @@
 		asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth);
 	}
 
-	/* send extra headers if requested */
-	if (http_extra_headers != NULL) {
-		asprintf (&buf, "%s%s", buf, http_extra_headers);
-	}
-
 	/* either send http POST data */
 	if (strlen (http_post_data)) {
 		asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf);