From 305dc8bcdca37b54fb43c71464066020733c720a Mon Sep 17 00:00:00 2001 From: lowit Date: Thu, 1 Dec 2022 15:26:16 +0300 Subject: [PATCH] path_raw: Add path_raw field Add a ability to get the request path without encoding --- README.md | 1 + http/server.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 7c5dc3a..c81111a 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/http/server.lua b/http/server.lua index 243c15a..7a53808 100644 --- a/http/server.lua +++ b/http/server.lua @@ -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"