blob: 4de2a17c9b94a1fa550253aff1199bfa6d255db4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
From 525910f1caaa12669d51b86c9f154586ff1c1815 Mon Sep 17 00:00:00 2001
From: John Abrahamsen <jhnabrhmsn@gmail.com>
Date: Fri, 24 Apr 2015 18:19:53 +0200
Subject: [PATCH] Case sensitive URL matching as requested in issue #142.
---
turbo/web.lua | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/turbo/web.lua b/turbo/web.lua
index 80cc40a..01224da 100644
--- a/turbo/web.lua
+++ b/turbo/web.lua
@@ -730,7 +730,13 @@ function web.RequestHandler:_execute()
end
self:prepare()
if not self._finished then
- self[self.request.method:lower()](self, unpack(self._url_args))
+ -- If there is no URL args then do not unpack as this has a significant
+ -- cost.
+ if self._url_args and #self._url_args > 0 then
+ self[self.request.method:lower()](self, unpack(self._url_args))
+ else
+ self[self.request.method:lower()](self)
+ end
if self._auto_finish and not self._finished then
self:finish()
end
@@ -1157,7 +1163,7 @@ end
-- class.
-- @param request (HTTPRequest instance)
function web.Application:_get_request_handlers(request)
- local path = request.path and request.path:lower()
+ local path = request.path
if not path then
path = "/"
end
|