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 5487950f6381f9c3476af7d674ada2b54eb98cc8
parent 98af796acd770fd2cee91b470352904a5b56f137
Author: Joris Vink <joris@coders.se>
Date:   Tue, 24 Apr 2018 20:11:13 +0200

cut off port from the domain when needed.

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

diff --git a/src/http.c b/src/http.c @@ -872,6 +872,7 @@ http_response_cookie(struct http_request *req, const char *name, const char *val, const char *path, time_t expires, u_int32_t maxage, struct http_cookie **out) { + char *p; struct http_cookie *ck; if (name == NULL || val == NULL) @@ -886,6 +887,9 @@ http_response_cookie(struct http_request *req, const char *name, ck->domain = kore_strdup(req->host); ck->flags = HTTP_COOKIE_HTTPONLY | HTTP_COOKIE_SECURE; + if ((p = strrchr(ck->domain, ':')) != NULL) + *p = '\0'; + if (path != NULL) ck->path = kore_strdup(path); else