From 525910f1caaa12669d51b86c9f154586ff1c1815 Mon Sep 17 00:00:00 2001 From: John Abrahamsen 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