<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: A curl-ier Curb &#8211; better cookie support in Curb</title>
	<atom:link href="http://blog.codefront.net/2009/06/18/better-cookie-support-in-curb/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.codefront.net/2009/06/18/better-cookie-support-in-curb/</link>
	<description>Rails, Firefox, Anime, Mac</description>
	<lastBuildDate>Sat, 04 Feb 2012 15:38:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Sergi</title>
		<link>http://blog.codefront.net/2009/06/18/better-cookie-support-in-curb/comment-page-1/#comment-740755</link>
		<dc:creator>Sergi</dc:creator>
		<pubDate>Wed, 27 Oct 2010 17:36:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/?p=1144#comment-740755</guid>
		<description>I&#039;ve found a solution to pass cookies from one page to other. Simply after doing the first perform, the next petition should be done with Curl::Easy.perform(2nd URL), no Curl::Easy.new

i.e:

curl = Curl::Easy.new(&#039;1st URL&#039;)
curl.enable_cookies = true
curl.cookiefile = &#039;/tmp/cookie.txt&#039;
curl.cookiejar = &#039;/tmp/cookie.txt&#039;
curl.http_post(post data)
curl.perform

curl = Curl::Easy.perform(&#039;2nd URL&#039;)</description>
		<content:encoded><![CDATA[<p>I&#8217;ve found a solution to pass cookies from one page to other. Simply after doing the first perform, the next petition should be done with Curl::Easy.perform(2nd URL), no Curl::Easy.new</p>
<p>i.e:</p>
<p>curl = Curl::Easy.new(&#8217;1st URL&#8217;)<br />
curl.enable_cookies = true<br />
curl.cookiefile = &#8216;/tmp/cookie.txt&#8217;<br />
curl.cookiejar = &#8216;/tmp/cookie.txt&#8217;<br />
curl.http_post(post data)<br />
curl.perform</p>
<p>curl = Curl::Easy.perform(&#8217;2nd URL&#8217;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anthony Ettinger</title>
		<link>http://blog.codefront.net/2009/06/18/better-cookie-support-in-curb/comment-page-1/#comment-737143</link>
		<dc:creator>Anthony Ettinger</dc:creator>
		<pubDate>Sun, 16 May 2010 08:19:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/?p=1144#comment-737143</guid>
		<description>I just found this explanation -- the cookiejar is NOT written until curl exits -- or curl_easy_cleanup is called. I do not see a method to do that in Curb:

http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html

I tried creating a new instance of Curl::Easy, but the script still doesn&#039;t write the file until the curl lib is done.</description>
		<content:encoded><![CDATA[<p>I just found this explanation &#8212; the cookiejar is NOT written until curl exits &#8212; or curl_easy_cleanup is called. I do not see a method to do that in Curb:</p>
<p><a href="http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html" rel="nofollow">http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html</a></p>
<p>I tried creating a new instance of Curl::Easy, but the script still doesn&#8217;t write the file until the curl lib is done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anthony Ettinger</title>
		<link>http://blog.codefront.net/2009/06/18/better-cookie-support-in-curb/comment-page-1/#comment-737142</link>
		<dc:creator>Anthony Ettinger</dc:creator>
		<pubDate>Sun, 16 May 2010 08:05:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/?p=1144#comment-737142</guid>
		<description>I had this problem earlier with curl...but how do I authenticate (save to cookiejar) and then re-use that cookiejar for subsequent requests?

It seems like the cookiejar isn&#039;t re-used from w/in the same script (2 curb calls) except on the next execute of the script...then it works.</description>
		<content:encoded><![CDATA[<p>I had this problem earlier with curl&#8230;but how do I authenticate (save to cookiejar) and then re-use that cookiejar for subsequent requests?</p>
<p>It seems like the cookiejar isn&#8217;t re-used from w/in the same script (2 curb calls) except on the next execute of the script&#8230;then it works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thufir</title>
		<link>http://blog.codefront.net/2009/06/18/better-cookie-support-in-curb/comment-page-1/#comment-735051</link>
		<dc:creator>Thufir</dc:creator>
		<pubDate>Mon, 01 Feb 2010 01:10:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/?p=1144#comment-735051</guid>
		<description>how do you create a cookie as:



You then have to add yourself a cookie (well, it look like Google doesn&#039;t add it itself) with the following properties :
name 	SID
domain 	.google.com
path 	/
expires 	1600000000

http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI


in your example, only the name is set.</description>
		<content:encoded><![CDATA[<p>how do you create a cookie as:</p>
<p>You then have to add yourself a cookie (well, it look like Google doesn&#8217;t add it itself) with the following properties :<br />
name 	SID<br />
domain 	.google.com<br />
path 	/<br />
expires 	1600000000</p>
<p><a href="http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI" rel="nofollow">http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI</a></p>
<p>in your example, only the name is set.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chu Yeow</title>
		<link>http://blog.codefront.net/2009/06/18/better-cookie-support-in-curb/comment-page-1/#comment-728604</link>
		<dc:creator>Chu Yeow</dc:creator>
		<pubDate>Tue, 18 Aug 2009 01:35:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/?p=1144#comment-728604</guid>
		<description>@Waseem here&#039;s an example (I actually use something like this in an app):

&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;curl = Curl::Easy.new(&#039;http://example.com/login&#039;)

# Extract cookies in response.
cookies = []
curl.on_header { &#124;header&#124;

  # Parse cookies from the headers (yes, this is a naive implementation but it&#039;s fast).
  cookies &lt;&lt; &quot;#{$1}=#{$2}&quot; if header =~ /^Set-Cookie: ([^=])=([^;]+;)/

  header.length
}

# POST to login.
curl.http_post(
  Curl::PostField.content(&#039;username&#039;, &#039;foo&#039;),
  Curl::PostField.content(&#039;password&#039;, &#039;bar&#039;)
)

# Reset the on_header handler.
curl.on_header

# Now you can use the auth cookies in future requests.
curl = Curl::Easy.new(&#039;http://example.com/private/page&#039;)
curl.cookies = cookies
curl.perform
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Waseem here&#8217;s an example (I actually use something like this in an app):</p>
<pre><code class="ruby">curl = Curl::Easy.new('<a href="http://example.com/login" rel="nofollow">http://example.com/login</a>')

# Extract cookies in response.
cookies = []
curl.on_header { |header|

  # Parse cookies from the headers (yes, this is a naive implementation but it's fast).
  cookies &lt;&lt; &quot;#{$1}=#{$2}&quot; if header =~ /^Set-Cookie: ([^=])=([^;]+;)/

  header.length
}

# POST to login.
curl.http_post(
  Curl::PostField.content(&#039;username&#039;, &#039;foo&#039;),
  Curl::PostField.content(&#039;password&#039;, &#039;bar&#039;)
)

# Reset the on_header handler.
curl.on_header

# Now you can use the auth cookies in future requests.
curl = Curl::Easy.new('<a href="http://example.com/private/page" rel="nofollow">http://example.com/private/page</a>')
curl.cookies = cookies
curl.perform
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Waseem</title>
		<link>http://blog.codefront.net/2009/06/18/better-cookie-support-in-curb/comment-page-1/#comment-728586</link>
		<dc:creator>Waseem</dc:creator>
		<pubDate>Mon, 17 Aug 2009 14:59:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codefront.net/?p=1144#comment-728586</guid>
		<description>That is awesome change to curb. Would you please supply some example as how to use this feature of curb? How to authenticate in a cookie-based authentication system?</description>
		<content:encoded><![CDATA[<p>That is awesome change to curb. Would you please supply some example as how to use this feature of curb? How to authenticate in a cookie-based authentication system?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

