From 269e5cb0073c0050351ad608f98c7ce5b417e308 Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Mon, 18 Nov 2013 00:53:08 +0100 Subject: [PATCH] Strip out port from HTTP host request if its present. --- src/http.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/http.c b/src/http.c index d25a24b..e32b2b9 100644 --- a/src/http.c +++ b/src/http.c @@ -55,6 +55,7 @@ int http_request_new(struct connection *c, struct spdy_stream *s, char *host, char *method, char *path, struct http_request **out) { + char *p; struct http_request *req; kore_debug("http_request_new(%p, %p, %s, %s, %s)", c, s, @@ -75,6 +76,10 @@ http_request_new(struct connection *c, struct spdy_stream *s, char *host, req->post_data = NULL; req->hdlr_extra = NULL; req->multipart_body = NULL; + + if ((p = strrchr(host, ':')) != NULL) + *p = '\0'; + kore_strlcpy(req->host, host, sizeof(req->host)); kore_strlcpy(req->path, path, sizeof(req->path));