mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +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
|
/* curl-shim.c - Implement a small subset of the curl API in terms of
|
||||||
* the iobuf HTTP API
|
* 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.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -291,6 +292,27 @@ curl_easy_perform(CURL *curl)
|
|||||||
return handle_error(curl,err,errstr);
|
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
|
/* This is not the same exact set that is allowed according to
|
||||||
RFC-2396, but it is what the real curl uses. */
|
RFC-2396, but it is what the real curl uses. */
|
||||||
#define VALID_URI_CHARS "abcdefghijklmnopqrstuvwxyz" \
|
#define VALID_URI_CHARS "abcdefghijklmnopqrstuvwxyz" \
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* curl-shim.h
|
/* 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.
|
* This file is part of GNUPG.
|
||||||
*
|
*
|
||||||
@ -53,6 +54,11 @@ typedef enum
|
|||||||
CURLOPT_SRVTAG_GPG_HACK
|
CURLOPT_SRVTAG_GPG_HACK
|
||||||
} CURLoption;
|
} CURLoption;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
CURLINFO_RESPONSE_CODE
|
||||||
|
} CURLINFO;
|
||||||
|
|
||||||
typedef size_t (*write_func)(char *buffer,size_t size,
|
typedef size_t (*write_func)(char *buffer,size_t size,
|
||||||
size_t nitems,void *outstream);
|
size_t nitems,void *outstream);
|
||||||
|
|
||||||
@ -92,6 +98,7 @@ void curl_global_cleanup(void);
|
|||||||
CURL *curl_easy_init(void);
|
CURL *curl_easy_init(void);
|
||||||
CURLcode curl_easy_setopt(CURL *curl,CURLoption option,...);
|
CURLcode curl_easy_setopt(CURL *curl,CURLoption option,...);
|
||||||
CURLcode curl_easy_perform(CURL *curl);
|
CURLcode curl_easy_perform(CURL *curl);
|
||||||
|
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );
|
||||||
void curl_easy_cleanup(CURL *curl);
|
void curl_easy_cleanup(CURL *curl);
|
||||||
char *curl_easy_escape(CURL *curl,char *str,int len);
|
char *curl_easy_escape(CURL *curl,char *str,int len);
|
||||||
#define curl_free(x) free(x)
|
#define curl_free(x) free(x)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user