kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 269e5cb0073c0050351ad608f98c7ce5b417e308
parent 7287b146ce596932ace03e5a7233843dd33d8e58
Author: Joris Vink <joris@coders.se>
Date:   Mon, 18 Nov 2013 00:53:08 +0100

Strip out port from HTTP host request if its present.

Diffstat:
src/http.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git 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));