aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2004-12-03 20:04:08 +0000
committerDavid Shaw <[email protected]>2004-12-03 20:04:08 +0000
commit445542c942c516024af5a56765a825c1b951267a (patch)
tree64ef342b416476bd1248c09d705574efdaf9e205
parent* cipher.h: Add PUBKEY_USAGE_UNKNOWN. (diff)
downloadgnupg-445542c942c516024af5a56765a825c1b951267a.tar.gz
gnupg-445542c942c516024af5a56765a825c1b951267a.zip
* http.c (send_request): Include the port if non-80 in the Host: header.
Noted by Jason Harris.
-rw-r--r--util/ChangeLog5
-rw-r--r--util/http.c35
2 files changed, 26 insertions, 14 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 35f4ad72b..3d9605bc1 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-03 David Shaw <[email protected]>
+
+ * http.c (send_request): Include the port if non-80 in the Host:
+ header. Noted by Jason Harris.
+
2004-08-23 Werner Koch <[email protected]>
* dotlock.c (destroy_dotlock): Remove the handle from the list of
diff --git a/util/http.c b/util/http.c
index 12c98016a..64a4d857d 100644
--- a/util/http.c
+++ b/util/http.c
@@ -501,21 +501,28 @@ send_request( HTTP_HD hd )
return G10ERR_NETWORK;
p = build_rel_path( hd->uri );
- request = m_alloc( strlen(server)*2 + strlen(p) + 50 );
- if( http_proxy ) {
+ request = m_alloc( strlen(server)*2 + strlen(p) + 65 );
+ if( http_proxy )
+ {
sprintf( request, "%s http://%s:%hu%s%s HTTP/1.0\r\n",
- hd->req_type == HTTP_REQ_GET ? "GET" :
- hd->req_type == HTTP_REQ_HEAD? "HEAD":
- hd->req_type == HTTP_REQ_POST? "POST": "OOPS",
- server, port, *p == '/'? "":"/", p );
- }
- else {
- sprintf( request, "%s %s%s HTTP/1.0\r\nHost: %s\r\n",
- hd->req_type == HTTP_REQ_GET ? "GET" :
- hd->req_type == HTTP_REQ_HEAD? "HEAD":
- hd->req_type == HTTP_REQ_POST? "POST": "OOPS",
- *p == '/'? "":"/", p, server);
- }
+ hd->req_type == HTTP_REQ_GET ? "GET" :
+ hd->req_type == HTTP_REQ_HEAD? "HEAD":
+ hd->req_type == HTTP_REQ_POST? "POST": "OOPS",
+ server, port, *p == '/'? "":"/", p );
+ }
+ else
+ {
+ char portstr[15];
+
+ if(port!=80)
+ sprintf(portstr,":%u",port);
+
+ sprintf( request, "%s %s%s HTTP/1.0\r\nHost: %s%s\r\n",
+ hd->req_type == HTTP_REQ_GET ? "GET" :
+ hd->req_type == HTTP_REQ_HEAD? "HEAD":
+ hd->req_type == HTTP_REQ_POST? "POST": "OOPS",
+ *p == '/'? "":"/", p, server, (port!=80)?portstr:"");
+ }
m_free(p);
rc = write_server( hd->sock, request, strlen(request) );