diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2010-11-30 01:21:57 +0100 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2010-11-30 01:31:04 +0100 |
commit | 7d9d62685fa141bacc34e795386ef567aa574ecb (patch) | |
tree | 9b3e9cb9825fa860da321f5bc1a8d1e5b3a1404e /lib | |
parent | 977c77aa085b10e48505c861f5d47b3e881170e2 (diff) |
Making cookies working properly, where they are more than one.
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 |