free(global_proxy_host);
free(global_proxy_port);
+ 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;
}
}
#endif
+ if (gnutls_check_version(GNUTLS_VERSION) == NULL) {
+ fprintf(stderr, "gnutls_check_version(): version mismatch, "
+ "expected at least '" GNUTLS_VERSION "'\n");
+ exit(EXIT_FAILURE);
+ }
+
/* Initialize GnuTLS. */
result = gnutls_global_init();
GNUTLS_ERROR_EXIT(result, "gnutls_global_init()");