*** 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 | -I [-u ] [-p ]\n\ [-w ] [-c ] [-t ] [-L]\n\ ! [-a auth] [-f ] [-e ]\n\ ! [-s string] [-l] [-r | -R ]\n\ ! [-P string] [-m :] [-4|-6] [-N] \n\ [-M ] [-A string] [-k string]\n", progname); } --- 1581,1589 ---- printf ("\ Usage: %s -H | -I [-u ] [-p ]\n\ [-w ] [-c ] [-t ] [-L]\n\ ! [-a auth] [-b auth] [-f ] \n\ ! [-e ] [-s string] [-l] \n\ ! [-r | -R ] [-P string]\n\ ! [-m :] [-4|-6] [-N] \n\ [-M ] [-A string] [-k string]\n", progname); }