[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

net/http: using cookies

Chris Eidhof

6/16/2005 11:42:00 AM

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


1 Answer

Vance A Heron

6/16/2005 10:34:00 PM

0

>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
On Thu, 2005-06-16 at 04:41, Chris Eidhof wrote:
> 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?