aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiale Zhi <vipcalio@gmail.com>2013-10-29 12:56:26 -0700
committerJiale Zhi <vipcalio@gmail.com>2013-10-29 12:56:26 -0700
commitc03e4c1adc54a9d0ce418f28ec505c1cb7215432 (patch)
tree869e9f892cd811e5f1ec868d9b58d0b9c4051ce4
parenta51034eda320f13eca2e0f05a0a17459d907d90e (diff)
downloadlua-resty-cookie-c03e4c1adc54a9d0ce418f28ec505c1cb7215432.tar.gz
lua-resty-cookie-c03e4c1adc54a9d0ce418f28ec505c1cb7215432.tar.bz2
lua-resty-cookie-c03e4c1adc54a9d0ce418f28ec505c1cb7215432.zip
Store string length for later use
-rw-r--r--lib/resty/cookie.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/resty/cookie.lua b/lib/resty/cookie.lua
index c6dfa07..1efe6b7 100644
--- a/lib/resty/cookie.lua
+++ b/lib/resty/cookie.lua
@@ -41,8 +41,9 @@ local function get_cookie_table(text_cookie)
local i = 1
local j = 1
local key, value
+ local len = #text_cookie
- while j <= #text_cookie do
+ while j <= len do
if state == EXPECT_KEY then
if get_string_byte(text_cookie, j) == EQUAL then
key = get_string_sub(text_cookie, i, j - 1)