summaryrefslogtreecommitdiffstats
path: root/web/attachments/113160-check_http.diff
blob: c2b1a45513528e26a5899664143804b160178215 (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
--- check_http.c.old	2004-12-01 15:57:08.000000000 +0100
+++ check_http.c	2004-12-06 11:56:11.000000000 +0100
@@ -112,6 +112,7 @@
 char *http_method;
 char *http_post_data;
 char buffer[MAX_INPUT_BUFFER];
+int do_soap = FALSE;
 
 int process_arguments (int, char **);
 static char *base64 (const char *bin, size_t len);
@@ -210,6 +211,7 @@
 		{"min", required_argument, 0, 'm'},
 		{"use-ipv4", no_argument, 0, '4'},
 		{"use-ipv6", no_argument, 0, '6'},
+		{"soap", no_argument, 0, 'W'},
 		{0, 0, 0, 0}
 	};
 
@@ -230,7 +232,7 @@
 	}
 
 	while (1) {
-		c = getopt_long (argc, argv, "Vvh46t:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLSm:", longopts, &option);
+		c = getopt_long (argc, argv, "Vvh46tW:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLSm:", longopts, &option);
 		if (c == -1 || c == EOF)
 			break;
 
@@ -384,6 +386,9 @@
 		case 'm': /* min_page_length */
 			min_page_len = atoi (optarg);
 			break;
+                case 'W': /* use SOAP mode */
+                        do_soap = TRUE;
+                        break;
 		}
 	}
 
@@ -519,9 +524,16 @@
 
 	/* either send http POST data */
 	if (http_post_data) {
-		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);
+		if (do_soap) {
+			asprintf (&buf, "%sSOAPAction:\r\n", buf);
+			asprintf (&buf, "%sContent-Type: text/xml; charset=utf-8\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);
+		} 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);
+		}
 	}
 	else {
 		/* or just a newline so the server knows we're done with the request */
@@ -1214,6 +1226,6 @@
   [-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\
-  [-P string] [-m min_pg_size] [-4|-6]\n"), progname);
+  [-P string] [-m min_pg_size] [-4|-6] [-W]\n"), progname);
 	printf (_(UT_HLP_VRS), progname, progname);
 }