aboutsummaryrefslogtreecommitdiffstats
path: root/keyserver/curl-shim.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2005-06-23 23:42:35 +0000
committerDavid Shaw <[email protected]>2005-06-23 23:42:35 +0000
commitccab129be56be608e9b196aec35ed9969b8c4c78 (patch)
tree65d8995f3d3acd8f6703635b085eca7e01c448c6 /keyserver/curl-shim.c
parent* curl-shim.h, curl-shim.c (curl_easy_setopt, curl_easy_perform): Add (diff)
downloadgnupg-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/curl-shim.c')
-rw-r--r--keyserver/curl-shim.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/keyserver/curl-shim.c b/keyserver/curl-shim.c
index 4828f5253..8575be220 100644
--- a/keyserver/curl-shim.c
+++ b/keyserver/curl-shim.c
@@ -29,6 +29,7 @@
#include <errno.h>
#include "http.h"
#include "util.h"
+#include "ksutil.h"
#include "curl-shim.h"
static CURLcode
@@ -142,10 +143,24 @@ curl_easy_perform(CURL *curl)
int rc;
CURLcode err=CURLE_OK;
const char *errstr=NULL;
+ char *proxy=NULL;
+
+ /* Emulate the libcurl proxy behavior. If the calling program set a
+ proxy, use it. If it didn't set a proxy or set it to NULL, check
+ for one in the environment. If the calling program explicitly
+ set a null-string proxy, don't set a proxy at all. */
+
+ if(curl->proxy)
+ {
+ if(*curl->proxy)
+ proxy=curl->proxy;
+ }
+ else
+ proxy=getenv(HTTP_PROXY_ENV);
if(curl->flags.post)
{
- rc=http_open(&curl->hd,HTTP_REQ_POST,curl->url,curl->auth,0,curl->proxy);
+ rc=http_open(&curl->hd,HTTP_REQ_POST,curl->url,curl->auth,0,proxy);
if(rc==0)
{
char content_len[50];
@@ -166,7 +181,7 @@ curl_easy_perform(CURL *curl)
}
else
{
- rc=http_open(&curl->hd,HTTP_REQ_GET,curl->url,curl->auth,0,curl->proxy);
+ rc=http_open(&curl->hd,HTTP_REQ_GET,curl->url,curl->auth,0,proxy);
if(rc==0)
{
rc=http_wait_response(&curl->hd,&curl->status);