STABLE-BRANCH-1-2 gnupg/util (ChangeLog http.c)

cvs user dshaw cvs at cvs.gnupg.org
Fri Dec 3 20:56:26 CET 2004


    Date: Friday, December 3, 2004 @ 21:04:08
  Author: dshaw
    Path: /cvs/gnupg/gnupg/util
     Tag: STABLE-BRANCH-1-2

Modified: ChangeLog http.c

* http.c (send_request): Include the port if non-80 in the Host: header.  
Noted by Jason Harris.


-----------+
 ChangeLog |    5 +++++
 http.c    |   35 +++++++++++++++++++++--------------
 2 files changed, 26 insertions(+), 14 deletions(-)


Index: gnupg/util/ChangeLog
diff -u gnupg/util/ChangeLog:1.100.2.28 gnupg/util/ChangeLog:1.100.2.29
--- gnupg/util/ChangeLog:1.100.2.28	Mon Aug 23 17:22:46 2004
+++ gnupg/util/ChangeLog	Fri Dec  3 21:04:08 2004
@@ -1,3 +1,8 @@
+2004-12-03  David Shaw  <dshaw at jabberwocky.com>
+
+	* http.c (send_request): Include the port if non-80 in the Host:
+	header.  Noted by Jason Harris.
+
 2004-08-23  Werner Koch  <wk at g10code.de>
 
 	* dotlock.c (destroy_dotlock): Remove the handle from the list of
Index: gnupg/util/http.c
diff -u gnupg/util/http.c:1.12.2.4 gnupg/util/http.c:1.12.2.5
--- gnupg/util/http.c:1.12.2.4	Thu Aug 19 22:28:01 2004
+++ gnupg/util/http.c	Fri Dec  3 21:04:08 2004
@@ -501,21 +501,28 @@
 	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) );




More information about the Gnupg-commits mailing list