mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
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.
This commit is contained in:
parent
1edc1b3751
commit
ca0b94d4d4
@ -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" \
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user