Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use bracket notation for HTTP/1.1 Host: header, as alain pointed out

in ipngwg (IETF adelaide).
  • Loading branch information...
commit 7f3f8f7a89b80a5f9c037acb105522cb1f1faaca 1 parent 8a161ae
sumikawa authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 freebsd3/usr.bin/fetch/http.c
9 freebsd3/usr.bin/fetch/http.c
View
@@ -220,8 +220,13 @@ http_parse(struct fetch_state *fs, const char *u)
*/
https->http_hostname = safe_strdup(hostname);
https->http_port = port;
- hosthdr = alloca(sizeof("Host: :\r\n") + 5 + strlen(hostname));
- sprintf(hosthdr, "Host: %s:%d\r\n", hostname, port);
+ if (strchr(hostname, ':')) {
+ hosthdr = alloca(sizeof("Host: :\r\n") + 7 + strlen(hostname));
+ sprintf(hosthdr, "Host: [%s]:%d\r\n", hostname, port);
+ } else {
+ hosthdr = alloca(sizeof("Host: :\r\n") + 5 + strlen(hostname));
+ sprintf(hosthdr, "Host: %s:%d\r\n", hostname, port);
+ }
https->http_host_header = safe_strdup(hosthdr);
/*
Please sign in to comment.
Something went wrong with that request. Please try again.