cookiejar without cgi

T

Thufir

How do you create a cookiejar? I googled:

ruby cookiejar example create help -bowling -rails -python -java -php
-pottery -ceramic -lyric -lyrics

and just can't find an example. Here's what I have:

require 'rubygems'
require 'curb'
require 'cgi'






cookie = CGI::Cookie.new
("SID","domain=.google.com","path=/","expires=1600000000")

puts cookie.inspect
puts cookie.to_s


#add cookie to cookiejar, and use curb
#c = Curl::Easy.http_post "https://www.google.com/accounts/
ClientLogin",



How can I do that without cgi?




thanks,

Thufir
 
B

Brian Candler

Thufir said:
Here's what I have:

require 'rubygems'
require 'curb'
require 'cgi'

cookie = CGI::Cookie.new
("SID","domain=.google.com","path=/","expires=1600000000")

puts cookie.inspect
puts cookie.to_s ...
How can I do that without cgi?

By emitting a Set-Cookie: header directly?
http://en.wikipedia.org/wiki/HTTP_cookie#Implementation

You can always look at the source of CGI::Cookie to see what it does,
and incorporate the bits you want. What's the reason for not using it?
 
T

Thufir

By emitting a Set-Cookie: header directly?http://en.wikipedia.org/wiki/HT= TP_cookie#Implementation

You can always look at the source of CGI::Cookie to see what it does,
and incorporate the bits you want. What's the reason for not using it?

What I meant to ask is how to do that from the curb library. There's:

curl =3D Curl::Easy.new('http://example.com/')
curl.cookies =3D 'auth=3Dabcdef; ASP.NET_SessionId=3Dbig-wall-of-text;'
curl.perform

http://blog.codefront.net/2009/06/18/better-cookie-support-in-curb/

but can the curb API create the same cookie as the cgi API, and, if
so, how? For convenience, I'd like to use just as few different API's
as possible, where possible. Alternately, how can that cookie created
from the cgi API be used by the curb API? Add the cookie to a
cookiejar which curb can access?


-Thufir
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top