mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-22 14:57:02 +01:00
* 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.
This commit is contained in:
parent
f5b59b119f
commit
d341143cd7
@ -1,3 +1,13 @@
|
||||
2004-12-24 David Shaw <dshaw@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@jabberwocky.com>
|
||||
|
||||
* gpgkeys_curl.c (main): New "follow-redirects" option. Takes an
|
||||
|
@ -23,16 +23,10 @@ EXTRA_PROGRAMS = gpgkeys_ldap gpgkeys_hkp gpgkeys_http gpgkeys_finger gpgkeys_cu
|
||||
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
|
||||
|
@ -35,19 +35,21 @@ 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 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 @@ main(int argc,char *argv[])
|
||||
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 @@ main(int argc,char *argv[])
|
||||
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 @@ main(int argc,char *argv[])
|
||||
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. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user