summaryrefslogtreecommitdiff
path: root/modules/mappers
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2020-02-08 01:14:28 +0000
committerEric Covener <covener@apache.org>2020-02-08 01:14:28 +0000
commita98d6a4cd12380ebbd516071090297814b9d010f (patch)
tree3cc9743a5be69cfac29e09e5913b5926a7197759 /modules/mappers
parentc1ac12fa3b94bf1aabf16acad38afdb4198f8f23 (diff)
downloadhttpd-a98d6a4cd12380ebbd516071090297814b9d010f.tar.gz
add SameSite to RewriteRule ... ... [CO]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873762 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/mappers')
-rw-r--r--modules/mappers/mod_rewrite.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c
index ad90d60dcf..f35752b0e1 100644
--- a/modules/mappers/mod_rewrite.c
+++ b/modules/mappers/mod_rewrite.c
@@ -2581,6 +2581,7 @@ static void add_cookie(request_rec *r, char *s)
char *path;
char *secure;
char *httponly;
+ char *samesite;
char *tok_cntx;
char *cookie;
@@ -2615,6 +2616,7 @@ static void add_cookie(request_rec *r, char *s)
path = expires ? apr_strtok(NULL, sep, &tok_cntx) : NULL;
secure = path ? apr_strtok(NULL, sep, &tok_cntx) : NULL;
httponly = secure ? apr_strtok(NULL, sep, &tok_cntx) : NULL;
+ samesite = httponly ? apr_strtok(NULL, sep, &tok_cntx) : NULL;
if (expires) {
apr_time_exp_t tms;
@@ -2654,6 +2656,11 @@ static void add_cookie(request_rec *r, char *s)
"; HttpOnly" : NULL,
NULL);
+ if (samesite && !strcasecmp(samesite, "0")) {
+ cookie = apr_pstrcat(rmain->pool, cookie, "; SameSite=",
+ samesite, NULL);
+ }
+
apr_table_addn(rmain->err_headers_out, "Set-Cookie", cookie);
apr_pool_userdata_set("set", notename, NULL, rmain->pool);
rewritelog(rmain, 5, NULL, "setting cookie '%s'", cookie);