Squashed 'src/deps/src/lua-resty-session/' changes from 8b5f8752f..5f2aed616

5f2aed616 chore(*): release 4.0.5
f4980f0e1 fix(dshm/memcached): add a missing return parameter as otherwise pool parameters are not respected

git-subtree-dir: src/deps/src/lua-resty-session
git-subtree-split: 5f2aed616d16fa7ca04dc40e23d6941740cd634d
This commit is contained in:
Théophile Diot 2023-09-15 14:22:59 +02:00
parent a3cd342f3e
commit d8ee65aa70
22 changed files with 196 additions and 128 deletions

View file

@ -2,6 +2,12 @@
All notable changes to `lua-resty-session` will be documented in this file.
## [4.0.5] - 2023-08-16
### Fixed
- fix(dshm/memcached): add a missing return parameter as otherwise pool parameters are not respected, fix #171
## [4.0.4] - 2023-06-05
### Changed
- chore(utils): remove dependency for lua_pack, fix #158

View file

@ -29,6 +29,7 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="modules/resty.session.html">resty.session</a></li>
@ -119,8 +120,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -294,6 +294,7 @@ pre .library { color: #0e7c6b; }
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
pre .string { color: #8080ff; }
pre .number { color: #f8660d; }
pre .function-name { color: #60447f; }
pre .operator { color: #2239a8; font-weight: bold; }
pre .preprocessor, pre .prepro { color: #a33243; }
pre .global { color: #800080; }

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -389,8 +390,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -359,8 +360,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -323,8 +324,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -342,8 +343,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -315,12 +316,12 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="keyword">if</span> <span class="keyword">not</span> exists <span class="keyword">then</span>
session:set_data({
session:<span class="function-name">set_data</span>({
cart = {},
})
session:save()
session:<span class="function-name">save</span>()
<span class="keyword">end</span></pre>
</ul>
@ -345,10 +346,10 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="keyword">if</span> exists <span class="keyword">then</span>
<span class="keyword">local</span> data = session:get_data()
ngx.req.set_header(<span class="string">"Authorization"</span>, <span class="string">"Bearer "</span> .. data.access_token)
<span class="keyword">local</span> data = session:<span class="function-name">get_data</span>()
ngx.req.<span class="function-name">set_header</span>(<span class="string">"Authorization"</span>, <span class="string">"Bearer "</span> .. data.access_token)
<span class="keyword">end</span></pre>
</ul>
@ -409,10 +410,10 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="keyword">if</span> exists <span class="keyword">then</span>
<span class="keyword">local</span> access_token = session:get(<span class="string">"access-token"</span>)
ngx.req.set_header(<span class="string">"Authorization"</span>, <span class="string">"Bearer "</span> .. access_token)
<span class="keyword">local</span> access_token = session:<span class="function-name">get</span>(<span class="string">"access-token"</span>)
ngx.req.<span class="function-name">set_header</span>(<span class="string">"Authorization"</span>, <span class="string">"Bearer "</span> .. access_token)
<span class="keyword">end</span></pre>
</ul>
@ -438,8 +439,8 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.new()
session.set_audience(<span class="string">"my-service"</span>)</pre>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">new</span>()
session.<span class="function-name">set_audience</span>(<span class="string">"my-service"</span>)</pre>
</ul>
</dd>
@ -484,8 +485,8 @@ session.set_audience(<span class="string">"my-service"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.new()
session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">new</span>()
session.<span class="function-name">set_subject</span>(<span class="string">"john@doe.com"</span>)</pre>
</ul>
</dd>
@ -509,9 +510,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="keyword">if</span> exists <span class="keyword">then</span>
<span class="keyword">local</span> subject = session.get_subject()
<span class="keyword">local</span> subject = session.<span class="function-name">get_subject</span>()
<span class="keyword">end</span></pre>
</ul>
@ -546,9 +547,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="keyword">if</span> exists <span class="keyword">then</span>
<span class="keyword">local</span> timeout = session.get_property(<span class="string">"timeout"</span>)
<span class="keyword">local</span> timeout = session.<span class="function-name">get_property</span>(<span class="string">"timeout"</span>)
<span class="keyword">end</span></pre>
</ul>
@ -1037,7 +1038,7 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.init({
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">init</span>({
audience = <span class="string">"my-application"</span>,
storage = <span class="string">"redis"</span>,
redis = {
@ -1082,9 +1083,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.new()
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">new</span>()
<span class="comment">-- OR
</span><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.new({
</span><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">new</span>({
audience = <span class="string">"my-application"</span>,
})</pre>
</ul>
@ -1131,9 +1132,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="comment">-- OR
</span><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open({
</span><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>({
audience = <span class="string">"my-application"</span>,
})</pre>
</ul>
@ -1180,9 +1181,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.start()
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">start</span>()
<span class="comment">-- OR
</span><span class="keyword">local</span> session, err, exists, refreshed = <span class="global">require</span> <span class="string">"resty.session"</span>.start({
</span><span class="keyword">local</span> session, err, exists, refreshed = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">start</span>({
audience = <span class="string">"my-application"</span>,
})</pre>
</ul>
@ -1238,9 +1239,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.logout()
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">logout</span>()
<span class="comment">-- OR
</span><span class="keyword">local</span> ok, err, exists, logged_out = <span class="global">require</span> <span class="string">"resty.session"</span>.logout({
</span><span class="keyword">local</span> ok, err, exists, logged_out = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">logout</span>({
audience = <span class="string">"my-application"</span>,
})</pre>
</ul>
@ -1285,9 +1286,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.destroy()
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">destroy</span>()
<span class="comment">-- OR
</span><span class="keyword">local</span> ok, err, exists, destroyed = <span class="global">require</span> <span class="string">"resty.session"</span>.destroy({
</span><span class="keyword">local</span> ok, err, exists, destroyed = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">destroy</span>({
cookie_name = <span class="string">"auth"</span>,
})</pre>
</ul>
@ -1299,8 +1300,8 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -392,8 +393,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -430,12 +431,12 @@
<h3>Usage:</h3>
<ul>
<pre class="example">CREATE TABLE IF NOT EXISTS sessions (
sid CHAR(<span class="number">43</span>) PRIMARY KEY,
name VARCHAR(<span class="number">255</span>),
<pre class="example">CREATE TABLE IF NOT EXISTS <span class="function-name">sessions</span> (
sid <span class="function-name">CHAR</span>(<span class="number">43</span>) PRIMARY KEY,
name <span class="function-name">VARCHAR</span>(<span class="number">255</span>),
data MEDIUMTEXT,
exp DATETIME,
INDEX (exp)
<span class="function-name">INDEX</span> (exp)
) CHARACTER SET ascii;</pre>
</ul>
@ -456,12 +457,12 @@
<h3>Usage:</h3>
<ul>
<pre class="example">CREATE TABLE IF NOT EXISTS sessions_meta (
aud VARCHAR(<span class="number">255</span>),
sub VARCHAR(<span class="number">255</span>),
sid CHAR(<span class="number">43</span>),
PRIMARY KEY (aud, sub, sid),
CONSTRAINT FOREIGN KEY (sid) REFERENCES sessions(sid) ON DELETE CASCADE ON UPDATE CASCADE
<pre class="example">CREATE TABLE IF NOT EXISTS <span class="function-name">sessions_meta</span> (
aud <span class="function-name">VARCHAR</span>(<span class="number">255</span>),
sub <span class="function-name">VARCHAR</span>(<span class="number">255</span>),
sid <span class="function-name">CHAR</span>(<span class="number">43</span>),
PRIMARY <span class="function-name">KEY</span> (aud, sub, sid),
CONSTRAINT FOREIGN <span class="function-name">KEY</span> (sid) REFERENCES <span class="function-name">sessions</span>(sid) ON DELETE CASCADE ON UPDATE CASCADE
) CHARACTER SET ascii;</pre>
</ul>
@ -472,8 +473,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -427,13 +428,13 @@
<h3>Usage:</h3>
<ul>
<pre class="example">CREATE TABLE IF NOT EXISTS sessions (
<pre class="example">CREATE TABLE IF NOT EXISTS <span class="function-name">sessions</span> (
sid TEXT PRIMARY KEY,
name TEXT,
data TEXT,
exp TIMESTAMP WITH TIME ZONE
);
CREATE INDEX ON sessions (exp);</pre>
CREATE INDEX ON <span class="function-name">sessions</span> (exp);</pre>
</ul>
</dd>
@ -453,11 +454,11 @@ CREATE INDEX ON sessions (exp);</pre>
<h3>Usage:</h3>
<ul>
<pre class="example">CREATE TABLE IF NOT EXISTS sessions_meta (
<pre class="example">CREATE TABLE IF NOT EXISTS <span class="function-name">sessions_meta</span> (
aud TEXT,
sub TEXT,
sid TEXT REFERENCES sessions (sid) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (aud, sub, sid)
sid TEXT REFERENCES <span class="function-name">sessions</span> (sid) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY <span class="function-name">KEY</span> (aud, sub, sid)
);</pre>
</ul>
@ -468,8 +469,8 @@ CREATE INDEX ON sessions (exp);</pre>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -455,8 +456,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -313,8 +314,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -401,8 +402,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -452,8 +453,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -356,8 +357,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -215,7 +216,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> is_fips = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.is_fips_mode()</pre>
<pre class="example"><span class="keyword">local</span> is_fips = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">is_fips_mode</span>()</pre>
</ul>
</dd>
@ -267,8 +268,8 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> packed_128 = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.bpack(<span class="number">1</span>, <span class="number">128</span>)
<span class="keyword">local</span> packed_now = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.bpack(<span class="number">8</span>, ngx.time())</pre>
<pre class="example"><span class="keyword">local</span> packed_128 = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">bpack</span>(<span class="number">1</span>, <span class="number">128</span>)
<span class="keyword">local</span> packed_now = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">bpack</span>(<span class="number">8</span>, ngx.<span class="function-name">time</span>())</pre>
</ul>
</dd>
@ -322,8 +323,8 @@
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> value = <span class="number">128</span>
<span class="keyword">local</span> packed_value = utils.bpack(<span class="number">1</span>, value)
<span class="keyword">local</span> unpacked_value = utils.bunpack(<span class="number">1</span>, packed_value)
<span class="keyword">local</span> packed_value = utils.<span class="function-name">bpack</span>(<span class="number">1</span>, value)
<span class="keyword">local</span> unpacked_value = utils.<span class="function-name">bunpack</span>(<span class="number">1</span>, packed_value)
<span class="global">print</span>(value == unpacked_value) <span class="comment">-- true</span></pre>
</ul>
@ -368,7 +369,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> trimmed = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.trim(<span class="string">" hello world "</span>)</pre>
<pre class="example"><span class="keyword">local</span> trimmed = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">trim</span>(<span class="string">" hello world "</span>)</pre>
</ul>
</dd>
@ -399,7 +400,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> json = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.encode_json({ hello = <span class="string">"world"</span> })</pre>
<pre class="example"><span class="keyword">local</span> json = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">encode_json</span>({ hello = <span class="string">"world"</span> })</pre>
</ul>
</dd>
@ -430,7 +431,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> tbl = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.decode_json(<span class="string">'{ "hello": "world" }'</span>)</pre>
<pre class="example"><span class="keyword">local</span> tbl = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">decode_json</span>(<span class="string">'{ "hello": "world" }'</span>)</pre>
</ul>
</dd>
@ -461,7 +462,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> encoded = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.encode_base64url(<span class="string">"test"</span>)</pre>
<pre class="example"><span class="keyword">local</span> encoded = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">encode_base64url</span>(<span class="string">"test"</span>)</pre>
</ul>
</dd>
@ -493,8 +494,8 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> encoded = utils.encode_base64url(<span class="string">"test"</span>)
<span class="keyword">local</span> decoded = utils.decode_base64url(encoded)</pre>
<span class="keyword">local</span> encoded = utils.<span class="function-name">encode_base64url</span>(<span class="string">"test"</span>)
<span class="keyword">local</span> decoded = utils.<span class="function-name">decode_base64url</span>(encoded)</pre>
</ul>
</dd>
@ -526,7 +527,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> test = <span class="string">"test"</span>
<span class="keyword">local</span> b64len = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.base64_size(#test)</pre>
<span class="keyword">local</span> b64len = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">base64_size</span>(#test)</pre>
</ul>
</dd>
@ -558,7 +559,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> test = <span class="string">"test"</span>
<span class="keyword">local</span> deflated = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.deflate((<span class="string">"a"</span>):rep(<span class="number">100</span>))</pre>
<span class="keyword">local</span> deflated = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">deflate</span>((<span class="string">"a"</span>):<span class="function-name">rep</span>(<span class="number">100</span>))</pre>
</ul>
</dd>
@ -590,8 +591,8 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> deflated = utils.deflate((<span class="string">"a"</span>):rep(<span class="number">100</span>))
<span class="keyword">local</span> inflated = utils.inflate(deflated)</pre>
<span class="keyword">local</span> deflated = utils.<span class="function-name">deflate</span>((<span class="string">"a"</span>):<span class="function-name">rep</span>(<span class="number">100</span>))
<span class="keyword">local</span> inflated = utils.<span class="function-name">inflate</span>(deflated)</pre>
</ul>
</dd>
@ -625,7 +626,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> bytes = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.rand_bytes(<span class="number">32</span>)</pre>
<pre class="example"><span class="keyword">local</span> bytes = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)</pre>
</ul>
</dd>
@ -659,7 +660,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> hash, err = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.sha256(<span class="string">"hello world"</span>)</pre>
<pre class="example"><span class="keyword">local</span> hash, err = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">sha256</span>(<span class="string">"hello world"</span>)</pre>
</ul>
</dd>
@ -706,9 +707,9 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.derive_hkdf_sha256(ikm, nonce, <span class="string">"encryption"</span>, <span class="number">32</span>)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.<span class="function-name">derive_hkdf_sha256</span>(ikm, nonce, <span class="string">"encryption"</span>, <span class="number">32</span>)</pre>
</ul>
</dd>
@ -760,8 +761,8 @@
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> pass = <span class="string">"my-super-secret-password"</span>
<span class="keyword">local</span> salt = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.derive_pbkdf2_hmac_sha256(pass, salt, <span class="string">"encryption"</span>, <span class="number">32</span>, <span class="number">10000</span>)</pre>
<span class="keyword">local</span> salt = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.<span class="function-name">derive_pbkdf2_hmac_sha256</span>(pass, salt, <span class="string">"encryption"</span>, <span class="number">32</span>, <span class="number">10000</span>)</pre>
</ul>
</dd>
@ -815,9 +816,9 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.derive_aes_gcm_256_key_and_iv(ikm, nonce, <span class="string">"Medium"</span>)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.<span class="function-name">derive_aes_gcm_256_key_and_iv</span>(ikm, nonce, <span class="string">"Medium"</span>)</pre>
</ul>
</dd>
@ -857,9 +858,9 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.derive_hmac_sha256_key(ikm, nonce)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.<span class="function-name">derive_hmac_sha256_key</span>(ikm, nonce)</pre>
</ul>
</dd>
@ -909,10 +910,10 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.derive_aes_gcm_256_key_and_iv(ikm, nonce)
<span class="keyword">local</span> enc, err, tag = utils.encrypt_aes_256_gcm(key, iv, <span class="string">"hello"</span>, <span class="string">"john@doe.com"</span>)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.<span class="function-name">derive_aes_gcm_256_key_and_iv</span>(ikm, nonce)
<span class="keyword">local</span> enc, err, tag = utils.<span class="function-name">encrypt_aes_256_gcm</span>(key, iv, <span class="string">"hello"</span>, <span class="string">"john@doe.com"</span>)</pre>
</ul>
</dd>
@ -963,11 +964,11 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.derive_aes_gcm_256_key_and_iv(ikm, nonce)
<span class="keyword">local</span> enc, err, tag = utils.encrypt_aes_256_gcm(key, iv, <span class="string">"hello"</span>, <span class="string">"john@doe.com"</span>)
<span class="keyword">local</span> out, err = utils.decrypt_aes_256_gcm(key, iv, ciphertext, <span class="string">"john@doe.com"</span>, tag)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.<span class="function-name">derive_aes_gcm_256_key_and_iv</span>(ikm, nonce)
<span class="keyword">local</span> enc, err, tag = utils.<span class="function-name">encrypt_aes_256_gcm</span>(key, iv, <span class="string">"hello"</span>, <span class="string">"john@doe.com"</span>)
<span class="keyword">local</span> out, err = utils.<span class="function-name">decrypt_aes_256_gcm</span>(key, iv, ciphertext, <span class="string">"john@doe.com"</span>, tag)</pre>
</ul>
</dd>
@ -1006,10 +1007,10 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.derive_hmac_sha256_key(ikm, nonce)
<span class="keyword">local</span> mac, err = utils.hmac_sha256(key, <span class="string">"hello"</span>)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.<span class="function-name">derive_hmac_sha256_key</span>(ikm, nonce)
<span class="keyword">local</span> mac, err = utils.<span class="function-name">hmac_sha256</span>(key, <span class="string">"hello"</span>)</pre>
</ul>
</dd>
@ -1048,7 +1049,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> postgres = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.load_storage(<span class="string">"postgres"</span>, {
<pre class="example"><span class="keyword">local</span> postgres = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">load_storage</span>(<span class="string">"postgres"</span>, {
postgres = {
host = <span class="string">"127.0.0.1"</span>,
}
@ -1094,9 +1095,9 @@
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> test = <span class="string">"aaaa"</span>
<span class="keyword">local</span> data, err = utils.deflate(test)
<span class="keyword">local</span> data, err = utils.<span class="function-name">deflate</span>(test)
<span class="keyword">if</span> <span class="keyword">not</span> data <span class="keyword">then</span>
<span class="global">print</span>(utils.errmsg(err, <span class="string">"unable to deflate data '%s'"</span>, test)
<span class="global">print</span>(utils.<span class="function-name">errmsg</span>(err, <span class="string">"unable to deflate data '%s'"</span>, test)
<span class="keyword">end</span></pre>
</ul>
@ -1173,7 +1174,7 @@
<ul>
<pre class="example"><span class="keyword">local</span> flags = <span class="number">0x0000</span>
<span class="keyword">local</span> FLAG_DOG = <span class="number">0x001</span>
flags = utils.set_flag(flags, FLAG_DOG)</pre>
flags = utils.<span class="function-name">set_flag</span>(flags, FLAG_DOG)</pre>
</ul>
</dd>
@ -1210,8 +1211,8 @@ flags = utils.set_flag(flags, FLAG_DOG)</pre>
<ul>
<pre class="example"><span class="keyword">local</span> options = <span class="number">0x0000</span>
<span class="keyword">local</span> FLAG_DOG = <span class="number">0x001</span>
flags = utils.set_flag(options, FLAG_DOG)
flags = utils.unset_flag(options, FLAG_DOG)</pre>
flags = utils.<span class="function-name">set_flag</span>(options, FLAG_DOG)
flags = utils.<span class="function-name">unset_flag</span>(options, FLAG_DOG)</pre>
</ul>
</dd>
@ -1249,9 +1250,9 @@ flags = utils.unset_flag(options, FLAG_DOG)</pre>
<pre class="example"><span class="keyword">local</span> flags = <span class="number">0x0000</span>
<span class="keyword">local</span> FLAG_DOG = <span class="number">0x001</span>
<span class="keyword">local</span> FLAG_BONE = <span class="number">0x010</span>
flags = utils.set_flag(flags, FLAG_DOG)
flags = utils.set_flag(flags, FLAG_BONE)
<span class="global">print</span>(utils.has_flag(flags, FLAG_BONE)</pre>
flags = utils.<span class="function-name">set_flag</span>(flags, FLAG_DOG)
flags = utils.<span class="function-name">set_flag</span>(flags, FLAG_BONE)
<span class="global">print</span>(utils.<span class="function-name">has_flag</span>(flags, FLAG_BONE)</pre>
</ul>
</dd>
@ -1362,8 +1363,8 @@ flags = utils.set_flag(flags, FLAG_BONE)
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -2194,7 +2194,7 @@ end
local session = {
_VERSION = "4.0.4",
_VERSION = "4.0.5",
metatable = metatable,
}

View file

@ -309,7 +309,7 @@ function storage.new(configuration)
local server_name = configuration and configuration.server_name
if pool or pool_size or backlog then
setmetatable({
return setmetatable({
prefix = prefix,
suffix = suffix,
host = host,

View file

@ -354,7 +354,7 @@ function storage.new(configuration)
local server_name = configuration and configuration.server_name
if pool or pool_size or backlog then
setmetatable({
return setmetatable({
prefix = prefix,
suffix = suffix,
host = host,

View file

@ -1,8 +1,8 @@
package = "lua-resty-session"
version = "4.0.4-1"
version = "4.0.5-1"
source = {
url = "git+https://github.com/bungle/lua-resty-session.git",
tag = "v4.0.4",
tag = "v4.0.5",
}
description = {
summary = "Session Library for OpenResty - Flexible and Secure",

View file

@ -136,4 +136,50 @@ describe("Testing utils", function()
end
end)
end)
describe("load_storage", function()
-- "dshm" is disabled as it currently cannot be checked by CI
for _, strategy in ipairs({ "memcached", "mysql", "postgres", "redis" }) do
it("respects pool parameters #" .. strategy, function()
local storage = assert(utils.load_storage(strategy, {
[strategy] = {
pool = "doge",
pool_size = 10,
backlog = 20,
},
}))
assert.equal("doge", storage.options.pool)
assert.equal(10, storage.options.pool_size)
assert.equal(20, storage.options.backlog)
end)
end
it("respects pool parameters #redis-sentinel", function()
local storage = assert(utils.load_storage("redis", {
redis = {
pool = "doge",
pool_size = 10,
backlog = 20,
sentinels = {},
},
}))
assert.equal("doge", storage.connector.config.connection_options.pool)
assert.equal(10, storage.connector.config.connection_options.pool_size)
assert.equal(20, storage.connector.config.connection_options.backlog)
end)
it("respects pool parameters #redis-cluster", function()
local storage = assert(utils.load_storage("redis", {
redis = {
pool = "doge",
pool_size = 10,
backlog = 20,
nodes = {},
},
}))
assert.equal("doge", storage.options.connect_opts.pool)
assert.equal(10, storage.options.connect_opts.pool_size)
assert.equal(20, storage.options.connect_opts.backlog)
end)
end)
end)