diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/HttpServ.cc | 6 | ||||
-rw-r--r-- | lib/httplib.lua | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/HttpServ.cc b/lib/HttpServ.cc index 2e1779b..7b757a9 100644 --- a/lib/HttpServ.cc +++ b/lib/HttpServ.cc @@ -915,11 +915,9 @@ void HttpResponse::PrepareResponse(Handle * b) { strftime(buf, 1024, "%a, %d %b %Y %H:%M:%S GMT", ft); (*b) << "Last-Modified: " << buf << "\r\n"; } - if (cookies.size()) { + for (std::vector<std::pair<String, String> >::iterator i = cookies.begin(); i != cookies.end(); i++) { (*b) << "Set-Cookie: "; - for (std::vector<std::pair<String, String> >::iterator i = cookies.begin(); i != cookies.end(); i++) { - (*b) << i->first << "=" << i->second << ";"; - } + (*b) << i->first << "=" << i->second << ";"; if (cookies_path != "") (*b) << "path=" << cookies_path; (*b) << "\r\n"; diff --git a/lib/httplib.lua b/lib/httplib.lua index 42c42a6..26d66bd 100644 --- a/lib/httplib.lua +++ b/lib/httplib.lua @@ -59,8 +59,8 @@ function get_cookies(req) local k, v for k, v in pairs(cookie_strings) do - local cname, cvalue = string.match(v, "(%w+)=(.+)") - cookies[cname] = cvalue + local cname, cvalue = string.match(v, "(%[^=]+)=(.+)") + if cname then cookies[trim(cname)] = trim(cvalue) end end end return cookies |