Skip to content

Commit

Permalink
path_raw: Add path_raw field
Browse files Browse the repository at this point in the history
Add a ability to get the request path without encoding
  • Loading branch information
lowitea authored and 0x501D committed Dec 21, 2022
1 parent 7881864 commit 305dc8b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ end

* `req.method` - HTTP request type (`GET`, `POST` etc).
* `req.path` - request path.
* `req.path_raw` - request path without decoding.
* `req.query` - request arguments.
* `req.proto` - HTTP version (for example, `{ 1, 1 }` is `HTTP/1.1`).
* `req.headers` - normalized request headers. A normalized header
Expand Down
1 change: 1 addition & 0 deletions http/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ local function parse_request(req)
if p.error then
return p
end
p.path_raw = p.path
p.path = uri_unescape(p.path)
if p.path:sub(1, 1) ~= "/" or p.path:find("./", nil, true) ~= nil then
p.error = "invalid uri"
Expand Down

0 comments on commit 305dc8b

Please sign in to comment.