summaryrefslogtreecommitdiffstats
path: root/web/attachments/152023-check_http.patch
blob: fa0b5c6270f93dedf06e2e4c770283155be235b9 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
*** check_http.c.orig	Mon Oct 10 21:00:43 2005
--- check_http.c	Mon Oct 10 21:09:02 2005
***************
*** 107,112 ****
--- 107,113 ----
  double critical_time = 0;
  int check_critical_time = FALSE;
  char user_auth[MAX_INPUT_BUFFER] = "";
+ char proxy_auth[MAX_INPUT_BUFFER] = "";
  int display_html = FALSE;
  char *http_opt_headers;
  int onredirect = STATE_OK;
***************
*** 220,225 ****
--- 221,228 ----
  		{"certificate", required_argument, 0, 'C'},
  		{"useragent", required_argument, 0, 'A'},
  		{"header", required_argument, 0, 'k'},
+ 		{"authorization", required_argument, 0, 'a'},
+ 		{"proxy-authorization", required_argument, 0, 'b'},
  		{"no-body", no_argument, 0, 'N'},
  		{"max-age", required_argument, 0, 'M'},
  		{"content-type", required_argument, 0, 'T'},
***************
*** 246,252 ****
  	}
  
  	while (1) {
! 		c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option);
  		if (c == -1 || c == EOF)
  			break;
  
--- 249,255 ----
  	}
  
  	while (1) {
! 		c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option);
  		if (c == -1 || c == EOF)
  			break;
  
***************
*** 355,360 ****
--- 358,367 ----
  			strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1);
  			user_auth[MAX_INPUT_BUFFER - 1] = 0;
  			break;
+ 		case 'b': /* proxy-authorization info */
+ 			strncpy (proxy_auth, optarg, MAX_INPUT_BUFFER - 1);
+ 			proxy_auth[MAX_INPUT_BUFFER - 1] = 0;
+ 			break;
  		case 'P': /* HTTP POST data in URL encoded format */
  			if (http_method || http_post_data) break;
  			http_method = strdup("POST");
***************
*** 835,840 ****
--- 842,854 ----
  		asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth);
  	}
  
+ 	/* optionally send the proxy authentication info */
+ 	if (strlen(proxy_auth)) {
+ 		auth = base64 (proxy_auth, strlen (proxy_auth));
+ 		asprintf (&buf, "%sProxy-Authorization: Basic %s\r\n", buf, auth);
+ 	}
+ 
+ 
  	/* either send http POST data */
  	if (http_post_data) {
  		if (http_content_type) {
***************
*** 1508,1513 ****
--- 1522,1529 ----
  	printf (_("\
   -a, --authorization=AUTH_PAIR\n\
     Username:password on sites with basic authentication\n\
+  -b, --proxy-authorization=AUTH_PAIR\n\
+    Username:password on proxy-servers with basic authentication\n\
   -A, --useragent=STRING\n\
     String to be sent in http header as \"User Agent\"\n\
   -k, --header=STRING\n\
***************
*** 1565,1572 ****
  	printf ("\
  Usage: %s -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\
!                   [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] \n\
                    [-M <age>] [-A string] [-k string]\n", progname);
  }
--- 1581,1589 ----
  	printf ("\
  Usage: %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n\
                    [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\
!                   [-a auth] [-b auth] [-f <ok | warn | critcal | follow>] \n\
! 		  [-e <expect>] [-s string] [-l] \n\
! 		  [-r <regex> | -R <case-insensitive regex>] [-P string]\n\
! 		  [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] \n\
                    [-M <age>] [-A string] [-k string]\n", progname);
  }