gnupg/keyserver (ChangeLog Makefile.am gpgkeys_curl.c)

cvs user dshaw cvs at cvs.gnupg.org
Fri Dec 24 20:43:18 CET 2004


    Date: Friday, December 24, 2004 @ 20:48:36
  Author: dshaw
    Path: /cvs/gnupg/gnupg/keyserver

Modified: ChangeLog Makefile.am gpgkeys_curl.c

* gpgkeys_curl.c (main): Use new defines for opting out of certain
transfer protocols.  Allow setting HTTP proxy via "http-proxy=foo" option
(there is natural support in libcurl for the http_proxy environment
variable).

* Makefile.am: Remove the conditional since this is all handled in
autoconf now.


----------------+
 ChangeLog      |   10 ++++++++++
 Makefile.am    |    8 +-------
 gpgkeys_curl.c |   40 +++++++++++++++++++++++++++-------------
 3 files changed, 38 insertions(+), 20 deletions(-)


Index: gnupg/keyserver/ChangeLog
diff -u gnupg/keyserver/ChangeLog:1.98 gnupg/keyserver/ChangeLog:1.99
--- gnupg/keyserver/ChangeLog:1.98	Wed Dec 22 20:19:10 2004
+++ gnupg/keyserver/ChangeLog	Fri Dec 24 20:48:36 2004
@@ -1,3 +1,13 @@
+2004-12-24  David Shaw  <dshaw at jabberwocky.com>
+
+	* gpgkeys_curl.c (main): Use new defines for opting out of certain
+	transfer protocols.  Allow setting HTTP proxy via "http-proxy=foo"
+	option (there is natural support in libcurl for the http_proxy
+	environment variable).
+
+	* Makefile.am: Remove the conditional since this is all handled in
+	autoconf now.
+
 2004-12-22  David Shaw  <dshaw at jabberwocky.com>
 
 	* gpgkeys_curl.c (main): New "follow-redirects" option.  Takes an
Index: gnupg/keyserver/Makefile.am
diff -u gnupg/keyserver/Makefile.am:1.23 gnupg/keyserver/Makefile.am:1.24
--- gnupg/keyserver/Makefile.am:1.23	Wed Dec 22 18:12:23 2004
+++ gnupg/keyserver/Makefile.am	Fri Dec 24 20:48:36 2004
@@ -23,16 +23,10 @@
 EXTRA_SCRIPTS = gpgkeys_mailto
 libexecdir = @libexecdir@/@PACKAGE@
 
-libexec_PROGRAMS = @GPGKEYS_LDAP@ @GPGKEYS_HKP@ @GPGKEYS_FINGER@
+libexec_PROGRAMS = @GPGKEYS_LDAP@ @GPGKEYS_HKP@ @GPGKEYS_FINGER@ @GPGKEYS_HTTP@ @GPGKEYS_CURL@
 libexec_SCRIPTS = @GPGKEYS_MAILTO@
 noinst_SCRIPTS = gpgkeys_test
 
-if HAVE_LIBCURL
-libexec_PROGRAMS += @GPGKEYS_CURL@
-else
-libexec_PROGRAMS += @GPGKEYS_HTTP@
-endif
-
 gpgkeys_ldap_SOURCES = gpgkeys_ldap.c ksutil.c ksutil.h
 gpgkeys_hkp_SOURCES = gpgkeys_hkp.c ksutil.c ksutil.h
 gpgkeys_http_SOURCES = gpgkeys_http.c ksutil.c ksutil.h
Index: gnupg/keyserver/gpgkeys_curl.c
diff -u gnupg/keyserver/gpgkeys_curl.c:1.3 gnupg/keyserver/gpgkeys_curl.c:1.4
--- gnupg/keyserver/gpgkeys_curl.c:1.3	Wed Dec 22 20:19:10 2004
+++ gnupg/keyserver/gpgkeys_curl.c	Fri Dec 24 20:48:36 2004
@@ -34,20 +34,22 @@
 extern char *optarg;
 extern int optind;
 
-#define GET         0
-#define MAX_SCHEME 20
-#define MAX_LINE   80
-#define MAX_PATH 1023
-#define MAX_AUTH  127
-#define MAX_HOST   79
-#define MAX_PORT    9
-#define MAX_URL (MAX_SCHEME+3+MAX_AUTH+1+1+MAX_HOST+1+1+MAX_PORT+1+1+MAX_PATH+1+50)
+#define GET           0
+#define MAX_LINE     80
+
+#define MAX_SCHEME   20
+#define MAX_AUTH    128
+#define MAX_HOST     80
+#define MAX_PORT     10
+#define MAX_PATH   1024
+#define MAX_PROXY   128
+#define MAX_URL (MAX_SCHEME+1+3+MAX_AUTH+1+1+MAX_HOST+1+1+MAX_PORT+1+1+MAX_PATH+1+50)
 
 #define STRINGIFY(x) #x
 #define MKSTRING(x) STRINGIFY(x)
 
 static int verbose=0;
-static char scheme[MAX_SCHEME+1],auth[MAX_AUTH+1],host[MAX_HOST+1]={'\0'},port[MAX_PORT+1]={'\0'},path[MAX_PATH+1]={'\0'};
+static char scheme[MAX_SCHEME+1],auth[MAX_AUTH+1],host[MAX_HOST+1]={'\0'},port[MAX_PORT+1]={'\0'},path[MAX_PATH+1]={'\0'},proxy[MAX_PROXY+1]={'\0'};
 static FILE *input=NULL,*output=NULL,*console=NULL;
 static CURL *curl;
 static char request[MAX_URL]={'\0'};
@@ -266,6 +268,16 @@
 	      else
 		verbose++;
 	    }
+	  else if(strncasecmp(start,"http-proxy",10)==0)
+	    {
+	      if(no)
+		proxy[0]='\0';
+	      else if(start[10]=='=')
+		{
+		  strncpy(proxy,&start[11],MAX_PROXY);
+		  proxy[MAX_PROXY]='\0';
+		}
+	    }
 	  else if(strncasecmp(start,"timeout",7)==0)
 	    {
 	      if(no)
@@ -294,20 +306,20 @@
       fprintf(console,"gpgkeys: no scheme supplied!\n");
       return KEYSERVER_SCHEME_NOT_FOUND;
     }
-#ifndef HTTP_SUPPORT
+#ifndef HTTP_VIA_LIBCURL
   else if(strcasecmp(scheme,"http")==0)
     {
       fprintf(console,"gpgkeys: scheme `%s' not supported\n",scheme);
       return KEYSERVER_SCHEME_NOT_FOUND;
     }
-#endif /* HTTP_SUPPORT */
-#ifndef FTP_SUPPORT
+#endif /* HTTP_VIA_LIBCURL */
+#ifndef FTP_VIA_LIBCURL
   else if(strcasecmp(scheme,"ftp")==0)
     {
       fprintf(console,"gpgkeys: scheme `%s' not supported\n",scheme);
       return KEYSERVER_SCHEME_NOT_FOUND;
     }
-#endif /* FTP_SUPPORT */
+#endif /* FTP_VIA_LIBCURL */
 
   if(timeout && register_timeout()==-1)
     {
@@ -331,6 +343,8 @@
 	curl_easy_setopt(curl,CURLOPT_MAXREDIRS,follow_redirects);
     }
 
+  if(proxy[0])
+    curl_easy_setopt(curl,CURLOPT_PROXY,proxy);
 
   /* If it's a GET or a SEARCH, the next thing to come in is the
      keyids.  If it's a SEND, then there are no keyids. */




More information about the Gnupg-commits mailing list