From a51034eda320f13eca2e0f05a0a17459d907d90e Mon Sep 17 00:00:00 2001 From: Jiale Zhi Date: Tue, 29 Oct 2013 12:49:23 -0700 Subject: Deal with white space and tabs in cookie --- t/sanity.t | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 't') diff --git a/t/sanity.t b/t/sanity.t index bc52348..eb2086a 100644 --- a/t/sanity.t +++ b/t/sanity.t @@ -77,6 +77,7 @@ Cookie: SID=31d4d96e407aad42; lang=en-US lang => en-US + === TEST 3: no cookie header --- http_config eval: $::HttpConfig --- config @@ -100,6 +101,7 @@ no cookie found in current request --- response_body + === TEST 4: empty value --- http_config eval: $::HttpConfig --- config @@ -127,3 +129,28 @@ Cookie: SID= SID => + +=== TEST 5: cookie with space/tab +--- http_config eval: $::HttpConfig +--- config + location /t { + content_by_lua ' + local ck = require "resty.cookie" + local cookie, err = ck:new() + if not cookie then + ngx.log(ngx.ERR, err) + return + end + + local fields = cookie:get_all() + + for k, v in pairs(fields) do + ngx.say(k, " => ", v) + end + '; + } +--- request +GET /t +--- more_headers eval: "Cookie: SID=foo\t" +--- response_body +SID => foo -- cgit v1.2.3-70-g09d2