gnupg/util (ChangeLog http.c)
cvs user dshaw
cvs at cvs.gnupg.org
Mon Oct 18 17:48:39 CEST 2004
Date: Monday, October 18, 2004 @ 17:51:43
Author: dshaw
Path: /cvs/gnupg/gnupg/util
Modified: ChangeLog http.c
* http.c (connect_server, send_request): Use the URI scheme as the SRV tag
rather than hard-coding _hkp.
-----------+
ChangeLog | 5 +++++
http.c | 38 ++++++++++++++++++++++----------------
2 files changed, 27 insertions(+), 16 deletions(-)
Index: gnupg/util/ChangeLog
diff -u gnupg/util/ChangeLog:1.159 gnupg/util/ChangeLog:1.160
--- gnupg/util/ChangeLog:1.159 Sat Oct 16 23:31:36 2004
+++ gnupg/util/ChangeLog Mon Oct 18 17:51:43 2004
@@ -1,3 +1,8 @@
+2004-10-18 David Shaw <dshaw at jabberwocky.com>
+
+ * http.c (connect_server, send_request): Use the URI scheme as the
+ SRV tag rather than hard-coding _hkp.
+
2004-10-16 David Shaw <dshaw at jabberwocky.com>
* http.c (connect_server): [_WIN32] actually fill in the sin_addr
Index: gnupg/util/http.c
diff -u gnupg/util/http.c:1.27 gnupg/util/http.c:1.28
--- gnupg/util/http.c:1.27 Sat Oct 16 23:31:36 2004
+++ gnupg/util/http.c Mon Oct 18 17:51:43 2004
@@ -72,7 +72,8 @@
static byte *build_rel_path( PARSED_URI uri );
static int parse_response( HTTP_HD hd );
-static int connect_server(const char *server, ushort port, unsigned int flags);
+static int connect_server( const char *server, ushort port, unsigned int flags,
+ const char *srvtag );
static int write_server( int sock, const char *data, size_t length );
#ifdef _WIN32
@@ -309,13 +310,12 @@
*p2++ = 0;
strlwr( p );
uri->scheme = p;
- uri->port = 80;
- if( !strcmp( uri->scheme, "http" ) )
- ;
- else if( !strcmp( uri->scheme, "x-hkp" ) ) /* same as HTTP */
- uri->port = 11371;
+ if(strcmp(uri->scheme,"http")==0)
+ uri->port = 80;
+ else if(strcmp(uri->scheme,"hkp")==0)
+ uri->port = 11371;
else
- return G10ERR_INVALID_URI; /* Unsupported scheme */
+ return G10ERR_INVALID_URI; /* Unsupported scheme */
p = p2;
@@ -525,7 +525,7 @@
return G10ERR_NETWORK;
}
hd->sock = connect_server( *uri->host? uri->host : "localhost",
- uri->port? uri->port : 80, 0 );
+ uri->port? uri->port : 80, 0, NULL );
if(uri->auth)
{
char *x=make_radix64_string(uri->auth,strlen(uri->auth));
@@ -538,7 +538,7 @@
}
else
{
- hd->sock = connect_server( server, port, hd->flags );
+ hd->sock = connect_server( server, port, hd->flags, hd->uri->scheme );
if(hd->uri->auth)
{
char *x=make_radix64_string(hd->uri->auth,strlen(hd->uri->auth));
@@ -755,7 +755,8 @@
static int
-connect_server( const char *server, ushort port, unsigned int flags )
+connect_server( const char *server, ushort port, unsigned int flags,
+ const char *srvtag )
{
int sock=-1,srv,srvcount=0,connected=0,hostfound=0;
struct srventry *srvlist=NULL;
@@ -794,14 +795,19 @@
#ifdef USE_DNS_SRV
/* Do the SRV thing */
- if(flags&HTTP_FLAG_TRY_SRV)
+ if(flags&HTTP_FLAG_TRY_SRV && srvtag)
{
/* We're using SRV, so append the tags */
- char srvname[MAXDNAME];
- strcpy(srvname,"_hkp._tcp.");
- strncat(srvname,server,MAXDNAME-11);
- srvname[MAXDNAME-1]='\0';
- srvcount=getsrv(srvname,&srvlist);
+ if(1+strlen(srvtag)+6+strlen(server)+1<=MAXDNAME)
+ {
+ char srvname[MAXDNAME];
+
+ strcpy(srvname,"_");
+ strcat(srvname,srvtag);
+ strcat(srvname,"._tcp.");
+ strcat(srvname,server);
+ srvcount=getsrv(srvname,&srvlist);
+ }
}
#endif
More information about the Gnupg-commits
mailing list