while (fgets(buffer, sizeof(buffer), client_fd) != NULL) {
const char *authentication = "Proxy-Authorization: Basic ";
- if (http_digest_authorization != NULL
+ if (global_http_digest_authorization != NULL
&& !strncmp(buffer, authentication, strlen(authentication))) {
found_proxy_authorization = 1;
/* Check if the passphrase matches. */
strtok(buffer, "\r\n");
if (strcmp(buffer + strlen(authentication),
- http_digest_authorization)) {
+ global_http_digest_authorization)) {
return -3;
}
}
return -1;
}
- if (http_digest_authorization != NULL && !found_proxy_authorization) {
+ if (global_http_digest_authorization != NULL && !found_proxy_authorization) {
return -3;
}
free(global_proxy_host);
free(global_proxy_port);
- free(http_digest_authorization);
+ free(global_http_digest_authorization);
return EXIT_FAILURE;
}
while ((option = getopt(argc, argv, "a:d:p:t:uh?")) != -1) {
switch (option) {
case 'a': {
- http_digest_authorization = slurp_text_file(optarg);
- if (http_digest_authorization == NULL) {
+ global_http_digest_authorization = slurp_text_file(optarg);
+ if (global_http_digest_authorization == NULL) {
fprintf(stderr, "failed to open authorization file '%s': ",
optarg);
perror("");
exit(EXIT_FAILURE);
- } else if (strlen(http_digest_authorization) == 0) {
+ } else if (strlen(global_http_digest_authorization) == 0) {
fprintf(stderr, "empty authorization file '%s'\n",
optarg);
exit(EXIT_FAILURE);
}
/* Just in case the file has a trailing newline. */
- strtok(http_digest_authorization, "\r\n");
+ strtok(global_http_digest_authorization, "\r\n");
break;
}
char *global_proxy_port;
/* Passphrase for authentication of this proxy. Used with the -a option. */
-char *http_digest_authorization;
+char *global_http_digest_authorization;
/* Log level, command line option. */
int global_log_level;