Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

curb-fu - easy-to-use wrapper around curb - the ruby wrapper around libcurl

Curb can be found at


This gem is released under the terms of the Ruby license. See the LICENSE file for details.


If you are POSTing data and curb seems to be locking up, try posting it with an explicit 'Expect: 100-continue' header.

You can set this per-request, e.g.{:host => '', :headers => { "Expect" => "100-continue" }}, { "data" => "here" })

or you can configure it as a global header, e.g.

CurbFu.global_headers = { "Expect" => "100-continue" }
# ... then make your requests as normal

however you feel best.



$ gem install curb-fu --source

Or, if you have the source:

$ cd <source-dir>
$ rake gem
$ gem install pkg/


Urls can be requested using hashes of options or strings. The GET, POST, PUT, and DELETE methods are supported through their respective methods on CurbFu and CurbFu::Request.

String Examples

response = CurbFu.get('')
puts response.body

response ='', { :color => 'red', :shape => 'sphere' })
puts response.body unless response.success?

If you need to pass custom headers, you can still pass a string URL with :url :

response = => '', :headers => {'Content-Type' => 'application/xml'})

Hash Examples

response = CurbFu.get(:host => '', :path => '/gdi/curb-fu')
puts response.body

response ={:host => '', :path => '/some/resource'}, { :color => 'red', :shape => 'sphere' })
puts response.body unless response.success?

if you need https:

response ={:host => '', :path => '/some/resource', :protocol => "https"}, { :color => 'red', :shape => 'sphere' })

Cookies; changes as of 0.6.1

if you want to send a cookie, previous to 0.6.1 you have to pass a block to the HTTP verb method like so:

response = CurbFu.get("") do |curb|
  curb.cookies = "SekretToken=123234234235;"

As of 0.6.1 one can set the cookies either as an optional final parameter or via a hash, e.g.:

response = CurbFu.get("", { :param => "value" }, "SekretToken=123234;")
# or with a hash:
response = CurbFu.get({ :host => "http://myhost", :cookies => "SekretToken=1234;" })


Following Redirects, and other advanced topics

you can pass a block to the CurbFu methods, we will yield the Curl::Easy object to this block to allow you to reach as far into the Curb guts as you want. This is particularly useful if you want to follow redirects:

resp = CurbFu.get('') { |curb| curb.follow_location = true }

n.b. we would happily entertain pull requests to add some sugar to common configuration items.

Have fun!


  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
  • Send a pull request!


Original Authorship


Simple, yet powerful wrapper for taf2's curb (libcurl) library







No packages published