it's a simple cookie support without expire .
in "node_modules\jquery\node_modules\xmlhttprequest\lib\XMLHttpRequest.js"
------------->this.getAllResponseHeaders
if (i !== "set-cookie" && i !== "set-cookie2") {
result += i + ": " + response.headers[i] + "\r\n";
}
else
{
var baseUrl = Url.parse(settings.url).host;
if(!(baseUrl in cookie_dic)) cookie_dic[baseUrl] = {};
for(var cookie_i in response.headers[i])
{
response.headers[i][cookie_i].split(';').forEach(function(cookie) {
var parts = cookie.split('=');
cookie_dic[baseUrl][parts[0].trim()] = (parts[1]||'').trim();
});
}
}
-------------->this.send
if(headers['Host'] in cookie_dic)
{
headers['cookie'] = "";
for(var cookie_name in cookie_dic[headers['Host']])
headers['cookie'] += cookie_name + '=' +
cookie_dic[headers['Host']][cookie_name] + ";";
headers['cookie'] = headers['cookie'].substr(0,
headers['cookie'].length -1);
}
add "var cookie_dic = {};" in top
done
在 2010年4月24日星期六UTC+8下午4时24分47秒,robb1e写道:
>
> Hi,
>
> I'm trying to build a server side javascript application that serves
> as a bot running against a web application (grapevinetalk.com). The
> API depends on basic auth and cookies for authentication and I'm
> looking for a container that can manage cookies. I've looked at Rhino
> and hit some issues even combined with envjs.com. Does nodejs manage
> cookies, or is there a nice way that someone thinks that it could be
> made to manage cookies?
>
> I've also got a lot of existing code using jQuery that I'd like to
> reuse, so does nodejs support jQuery?
>
> Many thanks
>
> Robbie
>
> --
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To post to this group, send email to [email protected] <javascript:>.
>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>.
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en.
>
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.