diff options
author | David Shaw <[email protected]> | 2005-06-23 23:42:35 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2005-06-23 23:42:35 +0000 |
commit | ccab129be56be608e9b196aec35ed9969b8c4c78 (patch) | |
tree | 65d8995f3d3acd8f6703635b085eca7e01c448c6 /keyserver/gpgkeys_hkp.c | |
parent | * curl-shim.h, curl-shim.c (curl_easy_setopt, curl_easy_perform): Add (diff) | |
download | gnupg-ccab129be56be608e9b196aec35ed9969b8c4c78.tar.gz gnupg-ccab129be56be608e9b196aec35ed9969b8c4c78.zip |
* gpgkeys_mailto.in, gpgkeys_test.in: Use @VERSION@ so version string
stays up to date.
* gpgkeys_http.c: Don't need to define HTTP_PROXY_ENV here since it's
in ksutil.h.
* gpgkeys_curl.c (get_key, main), gpgkeys_hkp.c (main): Pass AUTH
values to curl or curl-shim.
* curl-shim.c (curl_easy_perform), gpgkeys_curl.c (main),
gpgkeys_hkp.c (main): Use curl-style proxy semantics.
Diffstat (limited to 'keyserver/gpgkeys_hkp.c')
-rw-r--r-- | keyserver/gpgkeys_hkp.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/keyserver/gpgkeys_hkp.c b/keyserver/gpgkeys_hkp.c index 66f5a2cb0..1904cdefc 100644 --- a/keyserver/gpgkeys_hkp.c +++ b/keyserver/gpgkeys_hkp.c @@ -39,7 +39,6 @@ extern char *optarg; extern int optind; -static char proxy[MAX_PROXY+1]; static FILE *input,*output,*console; static CURL *curl; static struct ks_options *opt; @@ -384,6 +383,7 @@ main(int argc,char *argv[]) char line[MAX_LINE]; int failed=0; struct keylist *keylist=NULL,*keyptr=NULL; + char *proxy=NULL; console=stderr; @@ -479,19 +479,16 @@ main(int argc,char *argv[]) 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'; + free(proxy); + proxy=strdup(""); } - else if(start[10]=='\0') + else if(start[10]=='=') { - char *http_proxy=getenv(HTTP_PROXY_ENV); - if(http_proxy) + if(strlen(&start[11])<MAX_PROXY) { - strncpy(proxy,http_proxy,MAX_PROXY); - proxy[MAX_PROXY]='\0'; + free(proxy); + proxy=strdup(&start[11]); } } } @@ -531,13 +528,16 @@ main(int argc,char *argv[]) curl_easy_setopt(curl,CURLOPT_ERRORBUFFER,errorbuffer); + if(opt->auth) + curl_easy_setopt(curl,CURLOPT_USERPWD,opt->auth); + if(opt->debug) { curl_easy_setopt(curl,CURLOPT_STDERR,console); curl_easy_setopt(curl,CURLOPT_VERBOSE,1); } - if(proxy[0]) + if(proxy) curl_easy_setopt(curl,CURLOPT_PROXY,proxy); #if 0 @@ -704,5 +704,12 @@ main(int argc,char *argv[]) if(output!=stdout) fclose(output); + free_ks_options(opt); + + if(curl) + curl_easy_cleanup(curl); + + free(proxy); + return ret; } |