Forum: Ruby CURL-alike library for ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Yaroslav T. (Guest)
on 2006-03-15 18:36
(Received via mailing list)
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.
Ross B. (Guest)
on 2006-03-15 19:37
(Received via mailing list)
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] 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].

[1]: http://www.d1.dion.ne.jp/~matuyuki/ruby.html
[2]: http://www.d1.dion.ne.jp/~matuyuki/rbCurl-0.0.2a0.tgz
Yaroslav T. (Guest)
on 2006-03-15 20:13
(Received via mailing list)
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
Ross B. (Guest)
on 2006-03-15 20:41
(Received via mailing list)
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
unknown (Guest)
on 2006-03-15 22:34
(Received via mailing list)
+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....
Ross B. (Guest)
on 2006-03-16 01:25
(Received via mailing list)
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...
Yaroslav T. (Guest)
on 2006-03-16 17:30
(Received via mailing list)
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.
Dimitri A. (Guest)
on 2006-03-16 17:50
(Received via mailing list)
On 3/16/06, Yaroslav T. <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
This topic is locked and can not be replied to.