1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

* http.h, http.c (send_request): Pass in srvtag and make its presence

sufficient to turn the feature on.  (http_open): From here.
(http_document): And here.

* gpgkeys_hkp.c (srv_replace): New function to transform a SRV
hostname to a real hostname.  (main): Call it from here for the
HAVE_LIBCURL case (without libcurl is handled via the curl-shim).

* curl-shim.h, curl-shim.c (curl_easy_setopt, curl_easy_perform): Add
a CURLOPT_SRVTAG_GPG_HACK (passed through the the http engine).
This commit is contained in:
David Shaw 2009-05-28 04:25:25 +00:00
parent fb866ea151
commit a7205a080c
7 changed files with 125 additions and 35 deletions

View file

@ -1,5 +1,12 @@
2009-05-27 David Shaw <dshaw@jabberwocky.com>
From 1.4:
* http.h, http.c (send_request): Pass in srvtag and make its
presence sufficient to turn the feature on.
(http_open): From here.
(http_document): And here.
* srv.c (getsrv): Raise maximum packet size to 2048, as PACKETSZ
is too small these days.

View file

@ -128,8 +128,8 @@ static int remove_escapes (char *string);
static int insert_escapes (char *buffer, const char *string,
const char *special);
static uri_tuple_t parse_tuple (char *string);
static gpg_error_t send_request (http_t hd,
const char *auth, const char *proxy);
static gpg_error_t send_request (http_t hd, const char *auth,
const char *proxy, const char *srvtag);
static char *build_rel_path (parsed_uri_t uri);
static gpg_error_t parse_response (http_t hd);
@ -317,7 +317,7 @@ http_register_tls_callback ( gpg_error_t (*cb) (http_t, void *, int) )
gpg_error_t
http_open (http_t *r_hd, http_req_t reqtype, const char *url,
const char *auth, unsigned int flags, const char *proxy,
void *tls_context)
void *tls_context, const char *srvtag)
{
gpg_error_t err;
http_t hd;
@ -338,7 +338,7 @@ http_open (http_t *r_hd, http_req_t reqtype, const char *url,
err = http_parse_uri (&hd->uri, url);
if (!err)
err = send_request (hd, auth, proxy);
err = send_request (hd, auth, proxy, srvtag);
if (err)
{
@ -457,12 +457,12 @@ http_wait_response (http_t hd)
gpg_error_t
http_open_document (http_t *r_hd, const char *document,
const char *auth, unsigned int flags, const char *proxy,
void *tls_context)
void *tls_context, const char *srvtag)
{
gpg_error_t err;
err = http_open (r_hd, HTTP_REQ_GET, document, auth, flags,
proxy, tls_context);
proxy, tls_context, srvtag);
if (err)
return err;
@ -835,7 +835,7 @@ parse_tuple (char *string)
* Returns 0 if the request was successful
*/
static gpg_error_t
send_request (http_t hd, const char *auth, const char *proxy)
send_request (http_t hd, const char *auth, const char *proxy,const char *srvtag)
{
gnutls_session_t tls_session;
gpg_error_t err;
@ -893,13 +893,13 @@ send_request (http_t hd, const char *auth, const char *proxy)
hd->sock = connect_server (*uri->host ? uri->host : "localhost",
uri->port ? uri->port : 80,
hd->flags, hd->uri->scheme);
hd->flags, srvtag);
save_errno = errno;
http_release_parsed_uri (uri);
}
else
{
hd->sock = connect_server (server, port, hd->flags, hd->uri->scheme);
hd->sock = connect_server (server, port, hd->flags, srvtag);
save_errno = errno;
}
@ -1524,6 +1524,9 @@ connect_server (const char *server, unsigned short port,
int last_errno = 0;
struct srventry *serverlist = NULL;
/* Not currently using the flags */
(void)flags;
#ifdef HAVE_W32_SYSTEM
unsigned long inaddr;
@ -1559,7 +1562,7 @@ connect_server (const char *server, unsigned short port,
#ifdef USE_DNS_SRV
/* Do the SRV thing */
if ((flags & HTTP_FLAG_TRY_SRV) && srvtag)
if (srvtag)
{
/* We're using SRV, so append the tags. */
if (1+strlen (srvtag) + 6 + strlen (server) + 1 <= MAXDNAME)

View file

@ -63,9 +63,8 @@ enum
{
HTTP_FLAG_TRY_PROXY = 1,
HTTP_FLAG_NO_SHUTDOWN = 2,
HTTP_FLAG_TRY_SRV = 4,
HTTP_FLAG_LOG_RESP = 8,
HTTP_FLAG_NEED_HEADER = 16
HTTP_FLAG_LOG_RESP = 4,
HTTP_FLAG_NEED_HEADER = 8
};
struct http_context_s;
@ -82,7 +81,8 @@ gpg_error_t http_open (http_t *r_hd, http_req_t reqtype,
const char *auth,
unsigned int flags,
const char *proxy,
void *tls_context);
void *tls_context,
const char *srvtag);
void http_start_data (http_t hd);
@ -95,7 +95,8 @@ gpg_error_t http_open_document (http_t *r_hd,
const char *auth,
unsigned int flags,
const char *proxy,
void *tls_context);
void *tls_context,
const char *srvtag);
#ifdef HTTP_USE_ESTREAM
estream_t http_get_read_ptr (http_t hd);