diff options
author | David Shaw <[email protected]> | 2004-12-03 20:23:12 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2004-12-03 20:23:12 +0000 |
commit | 9cc9a79047112a3f18b4c583f291cc402b8b2816 (patch) | |
tree | ac4643a6f80fc1bdcaa516d82266cc79fd803c46 | |
parent | * Makefile.am: The harmless "ignored error" on gpgkeys_ldap install on top (diff) | |
download | gnupg-9cc9a79047112a3f18b4c583f291cc402b8b2816.tar.gz gnupg-9cc9a79047112a3f18b4c583f291cc402b8b2816.zip |
* http.c (send_request): Include the port if non-80 in the Host: header.
Noted by Jason Harris.
-rw-r--r-- | util/ChangeLog | 5 | ||||
-rw-r--r-- | util/http.c | 20 |
2 files changed, 19 insertions, 6 deletions
diff --git a/util/ChangeLog b/util/ChangeLog index 801b53d66..483723754 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-11-03 Timo Schulz <[email protected]> * strgutil.c (w32_strerror): New. diff --git a/util/http.c b/util/http.c index 8d5679181..a0e3c337c 100644 --- a/util/http.c +++ b/util/http.c @@ -553,7 +553,7 @@ send_request( HTTP_HD hd, const char *proxy ) 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 @@ send_request( HTTP_HD hd, const char *proxy ) 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); |