# CURL-alike library for ruby

**URL:** <https://www.ruby-forum.com/t/curl-alike-library-for-ruby/54968>\
**Category:** Ruby\
**Created:** [March 15, 2006, 5:36pm UTC](https://www.ruby-forum.com/t/curl-alike-library-for-ruby/54968 "2006-03-15T17:36:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaroslav\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/87869e/32.png) [@Yaroslav\_T](https://www.ruby-forum.com/u/Yaroslav_T)\
**Post date:** [March 15, 2006, 5:36pm UTC](https://www.ruby-forum.com/t/curl-alike-library-for-ruby/54968/1 "2006-03-15T17:36:35Z")

</div>

Hello.

Can you please advice me any CURL-alike library for ruby? I’ve found two  
projects named rCurl or alike but neither extension has been compiled on  
my FreeBSD box. Therefore looking for an alternative.

Any information is appreciated. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Yaroslav\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/87869e/32.png) [@Yaroslav\_T](https://www.ruby-forum.com/u/Yaroslav_T)\
**Post date:** [March 15, 2006, 6:37pm UTC](https://www.ruby-forum.com/t/curl-alike-library-for-ruby/54968/2 "2006-03-15T18:37:50Z")

</div>

On Thu, 2006-03-16 at 01:36 +0900, Yaroslav T. wrote:

> Hello.
> 
> Can you please advice me any CURL-alike library for ruby? I’ve found two  
> projects named rCurl or alike but neither extension has been compiled on  
> my FreeBSD box. Therefore looking for an alternative.

A while ago I had need of this, and made some changes to rbCurl [1](http://www.d1.dion.ne.jp/~matuyuki/ruby.html) to  
get it to compile against modern Ruby and GCC versions. I’ve not  
extensively tested it (ended up not using it in fact) but it seemed to  
work fairly well I think. The attached patch should work against the  
0.0.2 prealpha version of rbCurl at [2](http://www.d1.dion.ne.jp/~matuyuki/rbCurl-0.0.2a0.tgz).

---

<div class="post-metadata">

**Author:** ![Yaroslav\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/87869e/32.png) [@Yaroslav\_T](https://www.ruby-forum.com/u/Yaroslav_T)\
**Post date:** [March 15, 2006, 7:13pm UTC](https://www.ruby-forum.com/t/curl-alike-library-for-ruby/54968/3 "2006-03-15T19:13:51Z")

</div>

Patched successfully, but when i tried to compile the extension on Linux  
box with gcc4, it stopped with such error message:

init.c: In function ‘Init\_curl’:  
init.c:408: error: ‘CURL\_TIMECOND\_NONE’ undeclared (first use in this  
function)  
init.c:409: error: ‘CURL\_TIMECOND\_IFMODSINCE’ undeclared (first use in  
this function)  
init.c:410: error: ‘CURL\_TIMECOND\_IFUNMODSINCE’ undeclared (first use in  
this function)  
init.c:411: error: ‘CURL\_TIMECOND\_LASTMOD’ undeclared (first use in this  
function)  
init.c:413: error: ‘CURL\_HTTP\_VERSION\_NONE’ undeclared (first use in  
this function)  
init.c:414: error: ‘CURL\_HTTP\_VERSION\_1\_0’ undeclared (first use in this  
function)  
init.c:415: error: ‘CURL\_HTTP\_VERSION\_1\_1’ undeclared (first use in this  
function)  
init.c:417: error: ‘CURL\_SSLVERSION\_DEFAULT’ undeclared (first use in  
this function)  
init.c:418: error: ‘CURL\_SSLVERSION\_TLSv1’ undeclared (first use in this  
function)  
init.c:419: error: ‘CURL\_SSLVERSION\_SSLv2’ undeclared (first use in this  
function)  
init.c:420: error: ‘CURL\_SSLVERSION\_SSLv3’ undeclared (first use in this  
function)  
make: \*\*\* [init.o] Error 1

---

<div class="post-metadata">

**Author:** ![Yaroslav\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/87869e/32.png) [@Yaroslav\_T](https://www.ruby-forum.com/u/Yaroslav_T)\
**Post date:** [March 15, 2006, 7:41pm UTC](https://www.ruby-forum.com/t/curl-alike-library-for-ruby/54968/4 "2006-03-15T19:41:34Z")

</div>

On Thu, 2006-03-16 at 03:10 +0900, Yaroslav T. wrote:

> 

Hmm… I just tried it here with a fresh copy, and it worked straight  
away. IIRC they should be declared in curl/curl.h - maybe you have a  
different version or something?

Mine is:

$ curl --version  
curl 7.13.1 (i386-redhat-linux-gnu) libcurl/7.13.1 OpenSSL/0.9.7f  
zlib/1.2.2.2 libidn/0.5.15

---

<div class="post-metadata">

**Author:** ![Yaroslav\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/87869e/32.png) [@Yaroslav\_T](https://www.ruby-forum.com/u/Yaroslav_T)\
**Post date:** [March 16, 2006, 12:25am UTC](https://www.ruby-forum.com/t/curl-alike-library-for-ruby/54968/5 "2006-03-16T00:25:16Z")

</div>

On Thu, 2006-03-16 at 05:33 +0900, removed\_email\_address@domain.invalid wrote:

> +1 that Ruby is in major need of a cURL binding.
> 
> Too bad I don’t know how to do it… would love to see it done,  
> though…

I’ve found updating old extension code to Ruby 1.8 to be a great way to  
learn 🙂

I played a bit more with rbCurl and found it to be fairly stable and  
functional, so I posted a copy with my patch applied at:

```
http://roscopeco.co.uk/code/rbCurl-0.0.2-03.06.tar.gz

```

(I tried contacting the original author, but received no response -  
understandably I guess since it looks like it’s been a few years…)

Also, OP: You may find that you can get what you need fairly easily with  
net/http or open\_uri, both in the standard library…

---

<div class="post-metadata">

**Author:** ![Yaroslav\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/87869e/32.png) [@Yaroslav\_T](https://www.ruby-forum.com/u/Yaroslav_T)\
**Post date:** [March 15, 2006, 9:34pm UTC](https://www.ruby-forum.com/t/curl-alike-library-for-ruby/54968/6 "2006-03-15T21:34:00Z")

</div>

+1 that Ruby is in major need of a cURL binding.

Too bad I don’t know how to do it… would love to see it done,  
though…

---

<div class="post-metadata">

**Author:** ![Yaroslav\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/87869e/32.png) [@Yaroslav\_T](https://www.ruby-forum.com/u/Yaroslav_T)\
**Post date:** [March 16, 2006, 4:30pm UTC](https://www.ruby-forum.com/t/curl-alike-library-for-ruby/54968/7 "2006-03-16T16:30:53Z")

</div>

## I decided to use http-access2 - it was fairly easy to set up and use. Also i didn’t find any possibility to force open-uri not to check self-signed SSL certificates, which appeared to be made in one string when using http-access2:

## clnt = HTTPAccess2::Client.new clnt.ssl\_config.verify\_mode = nil

Ross B. wrote:

> I’ve found updating old extension code to Ruby 1.8 to be a great way to  
> Also, OP: You may find that you can get what you need fairly easily with  
> net/http or open\_uri, both in the standard library…

Regarding rbCurl: my curl version is 7.14.0 and the said extension  
doesn’t compile.

---

<div class="post-metadata">

**Author:** ![Yaroslav\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/87869e/32.png) [@Yaroslav\_T](https://www.ruby-forum.com/u/Yaroslav_T)\
**Post date:** [March 16, 2006, 4:50pm UTC](https://www.ruby-forum.com/t/curl-alike-library-for-ruby/54968/8 "2006-03-16T16:50:57Z")

</div>

On 3/16/06, Yaroslav T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> * * *
> 
> ## clnt = HTTPAccess2::Client.new clnt.ssl\_config.verify\_mode = nil

Try:

clnt.ssl\_config.verify\_mode = OpenSSL::SSL::VERIFY\_NONE

It took me awhile before I found this when I had to do it, too.

- Dimitri
