gnupg/util (ChangeLog http.c)

cvs user dshaw cvs at cvs.gnupg.org
Fri Dec 3 21:15:30 CET 2004


    Date: Friday, December 3, 2004 @ 21:23:12
  Author: dshaw
    Path: /cvs/gnupg/gnupg/util

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    |   20 ++++++++++++++------
 2 files changed, 19 insertions(+), 6 deletions(-)


Index: gnupg/util/ChangeLog
diff -u gnupg/util/ChangeLog:1.167 gnupg/util/ChangeLog:1.168
--- gnupg/util/ChangeLog:1.167	Wed Nov  3 21:03:46 2004
+++ gnupg/util/ChangeLog	Fri Dec  3 21:23:12 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-11-03  Timo Schulz  <twoaday at g10code.com>
 	
 	* strgutil.c (w32_strerror): New.
Index: gnupg/util/http.c
diff -u gnupg/util/http.c:1.28 gnupg/util/http.c:1.29
--- gnupg/util/http.c:1.28	Mon Oct 18 17:51:43 2004
+++ gnupg/util/http.c	Fri Dec  3 21:23:12 2004
@@ -553,7 +553,7 @@
 
     p = build_rel_path( hd->uri );
 
-    request=m_alloc(strlen(server)*2 + strlen(p) + (auth?strlen(auth):0) + 50);
+    request=m_alloc(strlen(server)*2 + strlen(p) + (auth?strlen(auth):0) + 65);
     if( proxy )
       sprintf( request, "%s http://%s:%hu%s%s HTTP/1.0\r\n%s",
 	       hd->req_type == HTTP_REQ_GET ? "GET" :
@@ -561,11 +561,19 @@
 	       hd->req_type == HTTP_REQ_POST? "POST": "OOPS",
 	       server, port,  *p == '/'? "":"/", p, auth?auth:"" );
     else
-      sprintf( request, "%s %s%s HTTP/1.0\r\nHost: %s\r\n%s",
-	       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, auth?auth:"");
+      {
+	char portstr[15];
+
+	if(port!=80)
+	  sprintf(portstr,":%u",port);
+
+	sprintf( request, "%s %s%s HTTP/1.0\r\nHost: %s%s\r\n%s",
+		 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:"",
+		 auth?auth:"");
+      }
 
     m_free(p);
 




More information about the Gnupg-commits mailing list