diff options
author | David Shaw <[email protected]> | 2012-12-15 15:35:19 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2012-12-15 15:35:19 +0000 |
commit | cbe98b2cb1e40ba253300e604996681ae191e363 (patch) | |
tree | 512b836f6fbb7a2aeb2f7faf04bf59584c90759e | |
parent | Fix issue 1446: honor ports given in SRV responses. (diff) | |
download | gnupg-cbe98b2cb1e40ba253300e604996681ae191e363.tar.gz gnupg-cbe98b2cb1e40ba253300e604996681ae191e363.zip |
Part of issue 1447: Pass proper Host header when SRV is used.
* common/http.c (send_request, connect_server): Set proper Host header
(no :port, host is that of the SRV) when SRV is used in the
curl-shim.
-rw-r--r-- | common/http.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/common/http.c b/common/http.c index ea8b8d5fe..5b67accc0 100644 --- a/common/http.c +++ b/common/http.c @@ -1009,7 +1009,7 @@ send_request (http_t hd, const char *auth, { char portstr[35]; - if (port == 80) + if (port == 80 || (srv && srv->used_server)) *portstr = 0; else sprintf (portstr, ":%u", port); @@ -1544,7 +1544,7 @@ connect_server (const char *server, unsigned short port, unsigned int flags, struct http_srv *srv) { int sock = -1; - int srvcount = 0; + int srvcount = 0, fakesrv = 0; int hostfound = 0; int srvindex, connected, chosen=-1; int last_errno = 0; @@ -1613,6 +1613,7 @@ connect_server (const char *server, unsigned short port, strncpy (serverlist->target, server, MAXDNAME); serverlist->target[MAXDNAME-1] = '\0'; srvcount = 1; + fakesrv = 1; } #ifdef HAVE_GETADDRINFO @@ -1713,7 +1714,7 @@ connect_server (const char *server, unsigned short port, } #endif /* !HAVE_GETADDRINFO */ - if(chosen>-1 && srv) + if(!fakesrv && chosen>-1 && srv) { srv->used_server = xstrdup (serverlist[chosen].target); srv->used_port = serverlist[chosen].port; |