Added ability to set cookie without escaping.#126
Merged
Conversation
printercu
reviewed
Jun 25, 2020
http/utils.lua
Outdated
| return string.format('%%%02X', string.byte(char)) | ||
| end | ||
|
|
||
| local function base_unescape(char) |
Contributor
There was a problem hiding this comment.
is it base16_decode/encode?
printercu
reviewed
Jun 25, 2020
http/router/response.lua
Outdated
| if options == nil then | ||
| options = {} | ||
| end | ||
| options = utils.extend({raw = false}, options, true) |
Contributor
There was a problem hiding this comment.
I think this line is unnecessary, because if not {}.raw is the same as if not {raw = false}.raw.
what about options = options or {}?
printercu
reviewed
Jun 25, 2020
| for case_name, case in pairs(test_table) do | ||
| local resp = get_object() | ||
| resp:setcookie({ name='name', value = case.value }) | ||
| t.assert_equals(resp.headers['set-cookie'], {"name=" .. case.result}, case_name) |
Contributor
There was a problem hiding this comment.
just a tip. such loops can be written in this way
local function assert_escaped_value(input, expected)
...
end
assert_escaped_value("f f", 'f%20f')
assert_escaped_value('f"f', 'f%22f')
`resp:setcookie` implicitly escaped cookie values. Added ability to set cookie without any escaping `resp:setcookie('name', 'value', {raw = true})`.
Also added escaping for cookie path, and changed escaping algorithm according to https://tools.ietf.org/html/rfc6265.
`req:cookie` implicitly unescaped cookie values. Added ability to get cookie without unescaping `req:cookie('name', {raw = true})`.
rosik
approved these changes
Jul 8, 2020
Closed
ligurio
added a commit
that referenced
this pull request
Oct 26, 2021
TODO: add unit tests
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
Also added escaping of cookie path, and changed escaping algorithm
according to [1].
These changes were added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
1. https://tools.ietf.org/html/rfc6265
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 26, 2021
TODO: add unit tests
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
Also added escaping of cookie path, and changed escaping algorithm
according to [1].
These changes were added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
1. https://tools.ietf.org/html/rfc6265
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 26, 2021
TODO: server_requests.test_get_escaped_cookie is broken
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 26, 2021
TODO: broken test
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
broken
ligurio
added a commit
that referenced
this pull request
Oct 26, 2021
TODO: server_requests.test_get_escaped_cookie is broken
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 26, 2021
TODO: broken test
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
broken
ligurio
added a commit
that referenced
this pull request
Oct 26, 2021
TODO: server_requests.test_get_escaped_cookie is broken
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 26, 2021
TODO: broken test
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
broken
ligurio
added a commit
that referenced
this pull request
Oct 27, 2021
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 27, 2021
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
Also added escaping for cookie path, and changed escaping algorithm
according to RFC 6265 "HTTP State Management Mechanism", see [1].
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
1. https://tools.ietf.org/html/rfc6265
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 27, 2021
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 27, 2021
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
Also added escaping for cookie path, and changed escaping algorithm
according to RFC 6265 "HTTP State Management Mechanism", see [1].
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
1. https://tools.ietf.org/html/rfc6265
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 27, 2021
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 27, 2021
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
Also added escaping for cookie path, and changed escaping algorithm
according to RFC 6265 "HTTP State Management Mechanism", see [1].
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
1. https://tools.ietf.org/html/rfc6265
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 28, 2021
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 28, 2021
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
Also added escaping for cookie path, and changed escaping algorithm
according to RFC 6265 "HTTP State Management Mechanism", see [1].
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
1. https://tools.ietf.org/html/rfc6265
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 28, 2021
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 28, 2021
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
Also added escaping for cookie path, and changed escaping algorithm
according to RFC 6265 "HTTP State Management Mechanism", see [1].
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
1. https://tools.ietf.org/html/rfc6265
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 28, 2021
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 28, 2021
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
Also added escaping for cookie path, and changed escaping algorithm
according to RFC 6265 "HTTP State Management Mechanism", see [1].
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
1. https://tools.ietf.org/html/rfc6265
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 28, 2021
Method req:cookie() implicitly unescapes cookie values. Commit adds
ability to get cookie without unescaping:
req:cookie('name', {
raw = true
})
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
Follows up #126
Part of #134
ligurio
added a commit
that referenced
this pull request
Oct 28, 2021
Method resp:setcookie() implicitly escapes cookie values. Commit adds
ability to set cookie without any escaping with option 'raw':
resp:setcookie('name', 'value', {
raw = true
})`
Also added escaping for cookie path, and changed escaping algorithm
according to RFC 6265 "HTTP State Management Mechanism", see [1].
This change was added as a part of http v2 support in commit 'Added
ability to set and get cookie without escaping'
(42e3002) and later reverted in scope
of ticket with discard v2.
1. https://tools.ietf.org/html/rfc6265
Follows up #126
Part of #134
themilchenko
added a commit
that referenced
this pull request
Oct 23, 2025
There were no way to update config on the run with method `config:reload()` instead of listen parameters. This patch fixes it, all options support config reload. Closes #126
themilchenko
added a commit
that referenced
this pull request
Oct 23, 2025
There were no way to update config on the run with method `config:reload()` instead of listen parameters. This patch fixes it, all options support config reload. Closes #126
themilchenko
added a commit
that referenced
this pull request
Oct 23, 2025
There were no way to update config on the run with method `config:reload()` instead of listen parameters. This patch fixes it, all options support config reload. Closes #126
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resp:setcookieimplicitly escaped cookie values. Added ability to set cookie without any escapingresp:setcookie('name', 'value', {raw = true}).Also added escaping for cookie path, and changed escaping algorithm according to https://tools.ietf.org/html/rfc6265.
Closes #114