Mercurial > hg > nginx
comparison src/http/modules/ngx_http_userid_filter_module.c @ 7719:c0cacad62cc8
Userid: userid_flags fixup.
In 7717:e3e8b8234f05, the 1st bit was incorrectly used. It shouldn't
be used for bitmask values, as it is used by NGX_CONF_BITMASK_SET.
Additionally, special value "off" added to make it possible to clear
inherited userid_flags value.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 29 Sep 2020 15:52:18 +0300 |
parents | e3e8b8234f05 |
children | ef6a3a99a81a |
comparison
equal
deleted
inserted
replaced
7718:8fe7ebe5adc4 | 7719:c0cacad62cc8 |
---|---|
13 #define NGX_HTTP_USERID_OFF 0 | 13 #define NGX_HTTP_USERID_OFF 0 |
14 #define NGX_HTTP_USERID_LOG 1 | 14 #define NGX_HTTP_USERID_LOG 1 |
15 #define NGX_HTTP_USERID_V1 2 | 15 #define NGX_HTTP_USERID_V1 2 |
16 #define NGX_HTTP_USERID_ON 3 | 16 #define NGX_HTTP_USERID_ON 3 |
17 | 17 |
18 #define NGX_HTTP_USERID_COOKIE_SECURE 0x0001 | 18 #define NGX_HTTP_USERID_COOKIE_OFF 0x0002 |
19 #define NGX_HTTP_USERID_COOKIE_HTTPONLY 0x0002 | 19 #define NGX_HTTP_USERID_COOKIE_SECURE 0x0004 |
20 #define NGX_HTTP_USERID_COOKIE_SAMESITE 0x0004 | 20 #define NGX_HTTP_USERID_COOKIE_HTTPONLY 0x0008 |
21 #define NGX_HTTP_USERID_COOKIE_SAMESITE_STRICT 0x0008 | 21 #define NGX_HTTP_USERID_COOKIE_SAMESITE 0x0010 |
22 #define NGX_HTTP_USERID_COOKIE_SAMESITE_LAX 0x0010 | 22 #define NGX_HTTP_USERID_COOKIE_SAMESITE_STRICT 0x0020 |
23 #define NGX_HTTP_USERID_COOKIE_SAMESITE_NONE 0x0020 | 23 #define NGX_HTTP_USERID_COOKIE_SAMESITE_LAX 0x0040 |
24 #define NGX_HTTP_USERID_COOKIE_SAMESITE_NONE 0x0080 | |
24 | 25 |
25 /* 31 Dec 2037 23:55:55 GMT */ | 26 /* 31 Dec 2037 23:55:55 GMT */ |
26 #define NGX_HTTP_USERID_MAX_EXPIRES 2145916555 | 27 #define NGX_HTTP_USERID_MAX_EXPIRES 2145916555 |
27 | 28 |
28 | 29 |
95 { ngx_null_string, 0 } | 96 { ngx_null_string, 0 } |
96 }; | 97 }; |
97 | 98 |
98 | 99 |
99 static ngx_conf_bitmask_t ngx_http_userid_flags[] = { | 100 static ngx_conf_bitmask_t ngx_http_userid_flags[] = { |
101 { ngx_string("off"), NGX_HTTP_USERID_COOKIE_OFF }, | |
100 { ngx_string("secure"), NGX_HTTP_USERID_COOKIE_SECURE }, | 102 { ngx_string("secure"), NGX_HTTP_USERID_COOKIE_SECURE }, |
101 { ngx_string("httponly"), NGX_HTTP_USERID_COOKIE_HTTPONLY }, | 103 { ngx_string("httponly"), NGX_HTTP_USERID_COOKIE_HTTPONLY }, |
102 { ngx_string("samesite=strict"), | 104 { ngx_string("samesite=strict"), |
103 NGX_HTTP_USERID_COOKIE_SAMESITE|NGX_HTTP_USERID_COOKIE_SAMESITE_STRICT }, | 105 NGX_HTTP_USERID_COOKIE_SAMESITE|NGX_HTTP_USERID_COOKIE_SAMESITE_STRICT }, |
104 { ngx_string("samesite=lax"), | 106 { ngx_string("samesite=lax"), |
750 | 752 |
751 ngx_conf_merge_uint_value(conf->enable, prev->enable, | 753 ngx_conf_merge_uint_value(conf->enable, prev->enable, |
752 NGX_HTTP_USERID_OFF); | 754 NGX_HTTP_USERID_OFF); |
753 | 755 |
754 ngx_conf_merge_bitmask_value(conf->flags, prev->flags, | 756 ngx_conf_merge_bitmask_value(conf->flags, prev->flags, |
755 NGX_CONF_BITMASK_SET); | 757 (NGX_CONF_BITMASK_SET|NGX_HTTP_USERID_COOKIE_OFF)); |
756 | 758 |
757 ngx_conf_merge_str_value(conf->name, prev->name, "uid"); | 759 ngx_conf_merge_str_value(conf->name, prev->name, "uid"); |
758 ngx_conf_merge_str_value(conf->domain, prev->domain, ""); | 760 ngx_conf_merge_str_value(conf->domain, prev->domain, ""); |
759 ngx_conf_merge_str_value(conf->path, prev->path, "; path=/"); | 761 ngx_conf_merge_str_value(conf->path, prev->path, "; path=/"); |
760 ngx_conf_merge_str_value(conf->p3p, prev->p3p, ""); | 762 ngx_conf_merge_str_value(conf->p3p, prev->p3p, ""); |