Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

net/http: using cookies

24 views
Skip to first unread message

Chris Eidhof

unread,
Jun 16, 2005, 7:41:53 AM6/16/05
to
Hey everyone,

I'm trying to post a form to a site using net/http. I think it works,
I'm not sure, but does net/http store cookies? Because I think that's
the problem: loggin in isn't very hard, but the cookies aren't stored.
Does anyone know of a way to do that?
--
Best regards,
Chris Eidhof


Vance A Heron

unread,
Jun 16, 2005, 6:34:00 PM6/16/05
to
>From a library I use at work ...

def login(username, password, domain = nil)
path = 'Login'
data = %Q{<?xml version="1.0" ?>
<authorization>
<username><![CDATA[#{username}]]></username>
<password><![CDATA[#{password}]]></password>\n}
data << %Q{<domain><![CDATA[#{domain}]]></domain>\n} if domain
data << %Q{</authorization>\n}
@headers.delete("cookie")
resp = post(path, data)
raise "DocuShare login failed" if resp.code != "200"
@headers["cookie"] = resp["set-cookie"]
resp["docushare-handle"]
end

HTH,
Vance

0 new messages