Thufir
February 1, 2010, 7:26am
1
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
Thufir
February 1, 2010, 3:04pm
2
Thufir wrote:
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?
Cookies are arbitrary pieces of data, usually chosen and first sent by the web server, and stored on the client computer by the web browser. The browser then sends them back to the server with every request, introducing states (memory of previous events) into otherwise stateless HTTP transactions. Without cookies, each retrieval of a web page or component of a web page would be an isolated event, largely unrelated to all other page views made by the user on the website. Although cookies are usual...
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?
Thufir
February 1, 2010, 7:30pm
3
On Feb 1, 6:05 am, Brian C. [email protected] wrote:
[…]
How can I do that without cgi?
By emitting a Set-Cookie: header directly?HTTP cookie - Wikipedia
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 = Curl::Easy.new(‘http://example.com/ ’)
curl.cookies = ‘auth=abcdef; ASP.NET_SessionId=big-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