summaryrefslogtreecommitdiffstats
path: root/keyserver/curl-shim.c
diff options
context:
space:
mode:
authorDavid Shaw <dshaw@jabberwocky.com>2009-05-28 18:20:49 +0200
committerDavid Shaw <dshaw@jabberwocky.com>2009-05-28 18:20:49 +0200
commitbcf540f2d05be031fc16d9faf572a75c65834f12 (patch)
tree93ae0636c57de16e0d91d24c9c0c63e79d3c1fd1 /keyserver/curl-shim.c
parent* http.h, http.c (send_request): Pass in srvtag and make its presence (diff)
downloadgnupg2-bcf540f2d05be031fc16d9faf572a75c65834f12.tar.xz
gnupg2-bcf540f2d05be031fc16d9faf572a75c65834f12.zip
Avoid caches to get the most recent copy of the key. This is bug #1061
Diffstat (limited to 'keyserver/curl-shim.c')
-rw-r--r--keyserver/curl-shim.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/keyserver/curl-shim.c b/keyserver/curl-shim.c
index 98b5b24c7..500d9f562 100644
--- a/keyserver/curl-shim.c
+++ b/keyserver/curl-shim.c
@@ -1,7 +1,7 @@
/* curl-shim.c - Implement a small subset of the curl API in terms of
* the iobuf HTTP API
*
- * Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -26,8 +26,8 @@
#include <stdio.h>
#include <errno.h>
-#include "http.h"
#include "util.h"
+#include "http.h"
#include "ksutil.h"
#include "curl-shim.h"
@@ -156,6 +156,9 @@ curl_easy_setopt(CURL *curl,CURLoption option,...)
case CURLOPT_STDERR:
curl->errors=va_arg(ap,FILE *);
break;
+ case CURLOPT_HTTPHEADER:
+ curl->headers=va_arg(ap,struct curl_slist *);
+ break;
default:
/* We ignore the huge majority of curl options */
break;
@@ -196,7 +199,8 @@ curl_easy_perform(CURL *curl)
if(curl->flags.post)
{
rc = http_open (&curl->hd, HTTP_REQ_POST, curl->url, curl->auth,
- 0, proxy, NULL, curl->srvtag);
+ 0, proxy, NULL, curl->srvtag,
+ curl->headers?curl->headers->list:NULL);
if (!rc)
{
unsigned int post_len = strlen(curl->postfields);
@@ -219,7 +223,8 @@ curl_easy_perform(CURL *curl)
else
{
rc = http_open (&curl->hd, HTTP_REQ_GET, curl->url, curl->auth,
- 0, proxy, NULL, curl->srvtag);
+ 0, proxy, NULL, curl->srvtag,
+ curl->headers?curl->headers->list:NULL);
if (!rc)
{
rc = http_wait_response (curl->hd);
@@ -350,3 +355,28 @@ curl_version_info(int type)
return &data;
}
+
+struct curl_slist *
+curl_slist_append(struct curl_slist *list,const char *string)
+{
+ if(!list)
+ {
+ list=calloc(1,sizeof(*list));
+ if(!list)
+ return NULL;
+ }
+
+ add_to_strlist(&list->list,string);
+
+ return list;
+}
+
+void
+curl_slist_free_all(struct curl_slist *list)
+{
+ if(list)
+ {
+ free_strlist(list->list);
+ free(list);
+ }
+}