Skip to content

Commit 305dc8b

Browse files
lowitea0x501D
authored andcommitted
path_raw: Add path_raw field
Add a ability to get the request path without encoding
1 parent 7881864 commit 305dc8b

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ end
242242

243243
* `req.method` - HTTP request type (`GET`, `POST` etc).
244244
* `req.path` - request path.
245+
* `req.path_raw` - request path without decoding.
245246
* `req.query` - request arguments.
246247
* `req.proto` - HTTP version (for example, `{ 1, 1 }` is `HTTP/1.1`).
247248
* `req.headers` - normalized request headers. A normalized header

http/server.lua

+1
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ local function parse_request(req)
744744
if p.error then
745745
return p
746746
end
747+
p.path_raw = p.path
747748
p.path = uri_unescape(p.path)
748749
if p.path:sub(1, 1) ~= "/" or p.path:find("./", nil, true) ~= nil then
749750
p.error = "invalid uri"

0 commit comments

Comments
 (0)