summaryrefslogtreecommitdiffstats
path: root/dirmngr/t-http.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-07-26 13:48:27 +0200
committerWerner Koch <wk@gnupg.org>2017-07-26 13:48:27 +0200
commitc5e5748480952e5bcedb16f6ce6ef7e435acb3c7 (patch)
tree8fb8f9486c5bdedf524a1885cba7940efdcf127b /dirmngr/t-http.c
parentdirmngr: Auto-enable Tor on startup or reload. (diff)
downloadgnupg2-c5e5748480952e5bcedb16f6ce6ef7e435acb3c7.tar.xz
gnupg2-c5e5748480952e5bcedb16f6ce6ef7e435acb3c7.zip
dirmngr: Do not use a blocking connect in Tor mode.
* dirmngr/http.c (http_raw_connect): Disable the timeout in Tor mode. (send_request): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'dirmngr/t-http.c')
-rw-r--r--dirmngr/t-http.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/dirmngr/t-http.c b/dirmngr/t-http.c
index b0f2bcf4e..440633db4 100644
--- a/dirmngr/t-http.c
+++ b/dirmngr/t-http.c
@@ -40,6 +40,7 @@
#include "../common/util.h"
#include "../common/logging.h"
+#include "dns-stuff.h"
#include "http.h"
#include <ksba.h>
@@ -312,9 +313,25 @@ main (int argc, char **argv)
if (!cafile)
cafile = prepend_srcdir ("tls-ca.pem");
+ if (verbose)
+ my_http_flags |= HTTP_FLAG_LOG_RESP;
+
+ if (verbose || debug)
+ http_set_verbose (verbose, debug);
+
/* http.c makes use of the assuan socket wrapper. */
assuan_sock_init ();
+ if ((my_http_flags & HTTP_FLAG_FORCE_TOR))
+ {
+ enable_dns_tormode (1);
+ if (assuan_sock_set_flag (ASSUAN_INVALID_FD, "tor-mode", 1))
+ {
+ log_error ("error enabling Tor mode: %s\n", strerror (errno));
+ log_info ("(is your Libassuan recent enough?)\n");
+ }
+ }
+
#if HTTP_USE_NTBTLS
log_info ("new session.\n");
err = http_session_new (&session, NULL,