aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2013-03-03 01:07:27 +0000
committerDavid Shaw <[email protected]>2013-03-03 01:39:22 +0000
commitca0b94d4d41c81045ed97fad0569ff4b64e5a6fe (patch)
tree2239f0ac85029a474791bcf7739a6f1883bf5a50
parentFix DNS check for recent OS X releases (diff)
downloadgnupg-ca0b94d4d41c81045ed97fad0569ff4b64e5a6fe.tar.gz
gnupg-ca0b94d4d41c81045ed97fad0569ff4b64e5a6fe.zip
Emulate curl_easy_getinfo and CURLINFO_RESPONSE_CODE in curl-shim.
* keyserver/curl-shim.h, keyserver/curl-shim.c (curl_easy_getinfo): New. Return the HTTP status code for the last transfer.
-rw-r--r--keyserver/curl-shim.c24
-rw-r--r--keyserver/curl-shim.h9
2 files changed, 31 insertions, 2 deletions
diff --git a/keyserver/curl-shim.c b/keyserver/curl-shim.c
index 857b5c184..ce510cb2b 100644
--- a/keyserver/curl-shim.c
+++ b/keyserver/curl-shim.c
@@ -1,7 +1,8 @@
/* curl-shim.c - Implement a small subset of the curl API in terms of
* the iobuf HTTP API
*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2012 Free Software Foundation, Inc.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2012,
+ * 2013 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -291,6 +292,27 @@ curl_easy_perform(CURL *curl)
return handle_error(curl,err,errstr);
}
+CURLcode
+curl_easy_getinfo(CURL *curl, CURLINFO info, ... )
+{
+ va_list ap;
+ long *var;
+
+ va_start(ap,info);
+
+ switch(info)
+ {
+ case CURLINFO_RESPONSE_CODE:
+ var=va_arg(ap,long *);
+ *var=curl->status;
+ break;
+ default:
+ break;
+ }
+
+ return handle_error(curl,CURLE_OK,NULL);
+}
+
/* This is not the same exact set that is allowed according to
RFC-2396, but it is what the real curl uses. */
#define VALID_URI_CHARS "abcdefghijklmnopqrstuvwxyz" \
diff --git a/keyserver/curl-shim.h b/keyserver/curl-shim.h
index 0d378e834..a8609dffc 100644
--- a/keyserver/curl-shim.h
+++ b/keyserver/curl-shim.h
@@ -1,5 +1,6 @@
/* curl-shim.h
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009,
+ * 2013 Free Software Foundation, Inc.
*
* This file is part of GNUPG.
*
@@ -53,6 +54,11 @@ typedef enum
CURLOPT_SRVTAG_GPG_HACK
} CURLoption;
+typedef enum
+ {
+ CURLINFO_RESPONSE_CODE
+ } CURLINFO;
+
typedef size_t (*write_func)(char *buffer,size_t size,
size_t nitems,void *outstream);
@@ -92,6 +98,7 @@ void curl_global_cleanup(void);
CURL *curl_easy_init(void);
CURLcode curl_easy_setopt(CURL *curl,CURLoption option,...);
CURLcode curl_easy_perform(CURL *curl);
+CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );
void curl_easy_cleanup(CURL *curl);
char *curl_easy_escape(CURL *curl,char *str,int len);
#define curl_free(x) free(x)