mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-10 21:38:50 +01:00
* curl-shim.h, curl-shim.c (curl_easy_setopt, curl_easy_perform): Add
a CURLOPT_SRVTAG_GPG_HACK (passed through the the http engine). * http.h: Allow passing srvtag to http_open and http_open_document. * http.c (http_open, http_open_document): Allow passing srvtag to http_open and http_open_document.
This commit is contained in:
parent
a5b708ba9c
commit
a929f4c78e
@ -1,3 +1,8 @@
|
|||||||
|
2009-04-02 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* http.h: Allow passing srvtag to http_open and
|
||||||
|
http_open_document.
|
||||||
|
|
||||||
2008-04-17 David Shaw <dshaw@jabberwocky.com>
|
2008-04-17 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* cipher.h: Add the 192-bit variant of Camellia.
|
* cipher.h: Add the 192-bit variant of Camellia.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* http.h - HTTP protocol handler
|
/* http.h - HTTP protocol handler
|
||||||
* Copyright (C) 1999, 2000, 2001, 2003, 2004,
|
* Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005,
|
||||||
* 2005 Free Software Foundation, Inc.
|
* 2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -54,8 +54,7 @@ typedef enum {
|
|||||||
/* put flag values into an enum, so that gdb can display them */
|
/* put flag values into an enum, so that gdb can display them */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
HTTP_FLAG_NO_SHUTDOWN = 1,
|
HTTP_FLAG_NO_SHUTDOWN = 1
|
||||||
HTTP_FLAG_TRY_SRV = 2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct http_context {
|
struct http_context {
|
||||||
@ -75,11 +74,13 @@ struct http_context {
|
|||||||
typedef struct http_context *HTTP_HD;
|
typedef struct http_context *HTTP_HD;
|
||||||
|
|
||||||
int http_open( HTTP_HD hd, HTTP_REQ_TYPE reqtype, const char *url,
|
int http_open( HTTP_HD hd, HTTP_REQ_TYPE reqtype, const char *url,
|
||||||
char *auth, unsigned int flags, const char *proxy );
|
char *auth, unsigned int flags, const char *proxy,
|
||||||
|
const char *srvtag );
|
||||||
void http_start_data( HTTP_HD hd );
|
void http_start_data( HTTP_HD hd );
|
||||||
int http_wait_response( HTTP_HD hd, unsigned int *ret_status );
|
int http_wait_response( HTTP_HD hd, unsigned int *ret_status );
|
||||||
void http_close( HTTP_HD hd );
|
void http_close( HTTP_HD hd );
|
||||||
int http_open_document( HTTP_HD hd, const char *document, char *auth,
|
int http_open_document( HTTP_HD hd, const char *document, char *auth,
|
||||||
unsigned int flags, const char *proxy );
|
unsigned int flags, const char *proxy,
|
||||||
|
const char *srvtag );
|
||||||
|
|
||||||
#endif /*G10_HTTP_H*/
|
#endif /*G10_HTTP_H*/
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2009-04-02 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* curl-shim.h, curl-shim.c (curl_easy_setopt, curl_easy_perform):
|
||||||
|
Add a CURLOPT_SRVTAG_GPG_HACK (passed through the the http
|
||||||
|
engine).
|
||||||
|
|
||||||
2009-04-01 David Shaw <dshaw@jabberwocky.com>
|
2009-04-01 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* gpgkeys_hkp.c (main): Switch default port for SSLized HKP to
|
* gpgkeys_hkp.c (main): Switch default port for SSLized HKP to
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* 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 Free Software Foundation, Inc.
|
* Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -134,6 +134,9 @@ curl_easy_setopt(CURL *curl,CURLoption option,...)
|
|||||||
case CURLOPT_POSTFIELDS:
|
case CURLOPT_POSTFIELDS:
|
||||||
curl->postfields=va_arg(ap,char *);
|
curl->postfields=va_arg(ap,char *);
|
||||||
break;
|
break;
|
||||||
|
case CURLOPT_SRVTAG_GPG_HACK:
|
||||||
|
curl->srvtag=va_arg(ap,char *);
|
||||||
|
break;
|
||||||
case CURLOPT_FAILONERROR:
|
case CURLOPT_FAILONERROR:
|
||||||
curl->flags.failonerror=va_arg(ap,long)?1:0;
|
curl->flags.failonerror=va_arg(ap,long)?1:0;
|
||||||
break;
|
break;
|
||||||
@ -182,7 +185,8 @@ curl_easy_perform(CURL *curl)
|
|||||||
|
|
||||||
if(curl->flags.post)
|
if(curl->flags.post)
|
||||||
{
|
{
|
||||||
rc=http_open(&curl->hd,HTTP_REQ_POST,curl->url,curl->auth,0,proxy);
|
rc=http_open(&curl->hd,HTTP_REQ_POST,curl->url,curl->auth,0,proxy,
|
||||||
|
curl->srvtag);
|
||||||
if(rc==0)
|
if(rc==0)
|
||||||
{
|
{
|
||||||
char content_len[50];
|
char content_len[50];
|
||||||
@ -203,7 +207,8 @@ curl_easy_perform(CURL *curl)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc=http_open(&curl->hd,HTTP_REQ_GET,curl->url,curl->auth,0,proxy);
|
rc=http_open(&curl->hd,HTTP_REQ_GET,curl->url,curl->auth,0,proxy,
|
||||||
|
curl->srvtag);
|
||||||
if(rc==0)
|
if(rc==0)
|
||||||
{
|
{
|
||||||
rc=http_wait_response(&curl->hd,&curl->status);
|
rc=http_wait_response(&curl->hd,&curl->status);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* curl-shim.h
|
/* curl-shim.h
|
||||||
* 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.
|
* This file is part of GNUPG.
|
||||||
*
|
*
|
||||||
@ -48,7 +48,8 @@ typedef enum
|
|||||||
CURLOPT_CAINFO,
|
CURLOPT_CAINFO,
|
||||||
CURLOPT_POST,
|
CURLOPT_POST,
|
||||||
CURLOPT_POSTFIELDS,
|
CURLOPT_POSTFIELDS,
|
||||||
CURLOPT_FAILONERROR
|
CURLOPT_FAILONERROR,
|
||||||
|
CURLOPT_SRVTAG_GPG_HACK
|
||||||
} CURLoption;
|
} CURLoption;
|
||||||
|
|
||||||
typedef size_t (*write_func)(char *buffer,size_t size,
|
typedef size_t (*write_func)(char *buffer,size_t size,
|
||||||
@ -63,6 +64,7 @@ typedef struct
|
|||||||
write_func writer;
|
write_func writer;
|
||||||
void *file;
|
void *file;
|
||||||
char *postfields;
|
char *postfields;
|
||||||
|
char *srvtag;
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
FILE *errors;
|
FILE *errors;
|
||||||
struct
|
struct
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
* http.c (connect_server): free (rather than xfree) the result of
|
* http.c (connect_server): free (rather than xfree) the result of
|
||||||
getsrv().
|
getsrv().
|
||||||
|
(http_open, http_open_document): Allow passing srvtag to http_open
|
||||||
|
and http_open_document.
|
||||||
|
|
||||||
* Makefile.am: Make srv.c part of libcompat instead of libutil.
|
* Makefile.am: Make srv.c part of libcompat instead of libutil.
|
||||||
|
|
||||||
|
13
util/http.c
13
util/http.c
@ -1,6 +1,6 @@
|
|||||||
/* http.c - HTTP protocol handler
|
/* http.c - HTTP protocol handler
|
||||||
* Copyright (C) 1999, 2001, 2002, 2003, 2004,
|
* Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||||
* 2005, 2009 Free Software Foundation, Inc.
|
* 2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -148,7 +148,8 @@ make_radix64_string( const byte *data, size_t len )
|
|||||||
|
|
||||||
int
|
int
|
||||||
http_open( HTTP_HD hd, HTTP_REQ_TYPE reqtype, const char *url,
|
http_open( HTTP_HD hd, HTTP_REQ_TYPE reqtype, const char *url,
|
||||||
char *auth, unsigned int flags, const char *proxy )
|
char *auth, unsigned int flags, const char *proxy,
|
||||||
|
const char *srvtag )
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -232,11 +233,11 @@ http_wait_response( HTTP_HD hd, unsigned int *ret_status )
|
|||||||
|
|
||||||
int
|
int
|
||||||
http_open_document( HTTP_HD hd, const char *document, char *auth,
|
http_open_document( HTTP_HD hd, const char *document, char *auth,
|
||||||
unsigned int flags, const char *proxy )
|
unsigned int flags, const char *proxy, const char *srvtag )
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = http_open(hd, HTTP_REQ_GET, document, auth, flags, proxy );
|
rc = http_open(hd, HTTP_REQ_GET, document, auth, flags, proxy, srvtag );
|
||||||
if( rc )
|
if( rc )
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
@ -836,7 +837,7 @@ connect_server( const char *server, ushort port, unsigned int flags,
|
|||||||
|
|
||||||
#ifdef USE_DNS_SRV
|
#ifdef USE_DNS_SRV
|
||||||
/* Do the SRV thing */
|
/* Do the SRV thing */
|
||||||
if(flags&HTTP_FLAG_TRY_SRV && srvtag)
|
if(srvtag)
|
||||||
{
|
{
|
||||||
/* We're using SRV, so append the tags */
|
/* We're using SRV, so append the tags */
|
||||||
if(1+strlen(srvtag)+6+strlen(server)+1<=MAXDNAME)
|
if(1+strlen(srvtag)+6+strlen(server)+1<=MAXDNAME)
|
||||||
|
Loading…
Reference in New Issue
Block a user