Two questions:
- How do I install the curl library for Ruby? I thought there was
one…??? - How come when I go ‘gem search curl’ I get:
root@rockhopper:~# gem search curl
*** LOCAL GEMS ***
root@rockhopper:~#
???
Two questions:
root@rockhopper:~# gem search curl
*** LOCAL GEMS ***
root@rockhopper:~#
???
On 10-05-18 02:35 PM, Xeno C. / Eskimo North and Gmail wrote:
root@rockhopper:~#
???
I just got the following responses trying to install curb and
curl-multi:
Building native extensions. This could take a while…
ERROR: Error installing curl-multi:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require’: no such file to load – mkmf (LoadError)
from extconf.rb:1
Gem files will remain installed in /var/lib/gems/1.8/gems/curb-0.7.1 for
inspection.
Results logged to /var/lib/gems/1.8/gems/curb-0.7.1/ext/gem_make.out
root@rhaptools:~# gem install curb
Building native extensions. This could take a while…
ERROR: Error installing curb:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require’: no such file to load – mkmf (LoadError)
from extconf.rb:1
Gem files will remain installed in /var/lib/gems/1.8/gems/curb-0.7.1 for
inspection.
Results logged to /var/lib/gems/1.8/gems/curb-0.7.1/ext/gem_make.out
On Tue, May 18, 2010 at 6:56 PM, Xeno C. / Eskimo North and
Gmail [email protected] wrote:
*** LOCAL GEMS ***
ERROR: Error installing curl-multi:
root@rhaptools:~# gem install curb
inspection.
Results logged to /var/lib/gems/1.8/gems/curb-0.7.1/ext/gem_make.out
You should try to search the forum first for the answer:
`require - Google Search’%3A+no+such+file+to+load±-+mkmf+(LoadError)+site%3Aruby-forum.com
Anyway, you need the ruby development packages. In ubuntu / debian its
named ruby1.8-dev (or ruby1.9-dev)
Bye
root@rockhopper:~#
???
gem search foo searches local gems. You want to search the remote gem
repository. So you need the -r flag:
metatron:~ james$ gem search -r curl
*** REMOTE GEMS ***
ARBarlow-rubycurl (1.5.0)
arbarlow-rubycurl (1.7.3)
cjbottaro-curly_mustache (0.0.0)
curl-multi (0.2)
curly (0.0.3)
curly_mustache (0.1.0)
juozasg-curl-multi (0.2.1)
recurly (0.1.4)
rubycurl (1.7.3)
typhoeus_curly (0.1.14)
metatron:~ james$
Well, I got that -dev thing installed with apt-get, and then I tried
again and
got this log:
find_executable: checking for curl-config… -------------------- no
have_library: checking for main() in -lcurl… -------------------- no
“gcc -o conftest -I. -I/usr/lib/ruby/1.8/i486-linux -I.
-D_FILE_OFFSET_BITS=64
-fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L.
-Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic
-lruby1.8-static
-lcurl -lpthread -lrt -ldl -lcrypt -lm -lc”
/usr/bin/ld: cannot find -lcurl
collect2: ld returned 1 exit status
checked program was:
/* begin /
1: /top/
2: int main() { return 0; }
3: int t() { void ((volatile p)()); p = (void (()()))main; return 0; }
/ end */
“gcc -o conftest -I. -I/usr/lib/ruby/1.8/i486-linux -I.
-D_FILE_OFFSET_BITS=64
-fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L.
-Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic
-lruby1.8-static
-lcurl -lpthread -lrt -ldl -lcrypt -lm -lc”
/usr/bin/ld: cannot find -lcurl
collect2: ld returned 1 exit status
checked program was:
/* begin /
1: /top/
2: int main() { return 0; }
3: int t() { main(); return 0; }
/ end */
and then this one:
/usr/bin/ruby1.8 extconf.rb
“-fno-strict-aliasing -g -g -O2 -fPIC $(cflags)”
checking for curl-config… no
checking for main() in -lcurl… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby1.8
–with-curl-dir
–without-curl-dir
–with-curl-include
–without-curl-include=${curl-dir}/include
–with-curl-lib
–without-curl-lib=${curl-dir}/lib
–with-curllib
–without-curllib
extconf.rb:19: Can’t find libcurl or curl/curl.h (RuntimeError)
Try passing --with-curl-dir or --with-curl-lib and
–with-curl-include
options to extconf.
On 10-05-18 04:28 PM, Xeno C. / Eskimo North and Gmail wrote:
So, I installed rubycurl, that being the listed package of greatest
maturity,
but no document I can find can seem to help me use it. Most of the
stuff on
line refers to curb or multi-curb it seems.
xc
On 10-05-18 04:12 PM, James H.on wrote:
Thank you. That appears to have gotten me going…
On 10-05-20 02:37 AM, Robert K. wrote:
Kind regards
robert
Yes, but I am trying to move from using curl on shell to getting the
same
functionality without the two extra forks to shell and to curl itself.
Plus the
native has a bad wrap, I don’t know if it’s deserved, but I haven’t
found it
copasetic myself.
2010/5/19 Xeno C. / Eskimo North and Gmail
[email protected]:
On 10-05-18 04:28 PM, Xeno C. / Eskimo North and Gmail wrote:
So, I installed rubycurl, that being the listed package of greatest
maturity, but no document I can find can seem to help me use it. Most of
the stuff on line refers to curb or multi-curb it seems.
You could also use net/http which is part of the standar library and
documented:
http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html
Kind regards
robert
2010/5/20 Xeno C. / Eskimo North and Gmail
[email protected]:
You could also use net/http which is part of the standar library and
documented:http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html
Yes, but I am trying to move from using curl on shell to getting the same
functionality without the two extra forks to shell and to curl itself. Plus
the native has a bad wrap, I don’t know if it’s deserved, but I haven’t
found it copasetic myself.
Why two forks? In order to start curl as an external process you just
need one fork and one exec (or use “system”). Also, why do you say
“but”? Net/HTTP does not need “curl” or any other external process so
I do not see how my suggestion contradicts your goal. On the
contrary, I deliberately suggested to use Net/HTTP in order to not
have to depend on gems or external processes.
Cheers
robert
On 10-05-20 08:01 AM, Robert K. wrote:
the stuff on line refers to curb or multi-curb it seems.
Among other things we have built the tool around curl facilities like
the
–trace-time function, and we don’t want to mix in new stuff, or add
variations
in the kind of data we get. Also, all the switches for handling post
data, HTTP
headers, cookies, etc are working well, and it’s not clear you can do
all of
those things, let alone in a reasonably good way, with the net/http. I
am
certainly interested in your opinion on that.
Curl registers timestamps for points before the socket connection, as
well as
for receipt of each of the important HTTP headers, and then after the
HTTP
protocol activities are over the closure steps. Can I get that from
net/http?
On May 20, 2010, at 10:45, Xeno C. / Eskimo North and Gmail
wrote:
Among other things we have built the tool around curl facilities like the --trace-time function, and we don’t want to mix in new stuff, or add variations in the kind of data we get. Also, all the switches for handling post data, HTTP headers, cookies, etc are working well, and it’s not clear you can do all of those things, let alone in a reasonably good way, with the net/http. I am certainly interested in your opinion on that.
Curl registers timestamps for points before the socket connection, as well as for receipt of each of the important HTTP headers, and then after the HTTP protocol activities are over the closure steps. Can I get that from net/http?
Yes. Here’s some pseudocode:
h = Net::HTTP.new
h.start do
p :connected!
h.request do |r|
p :headers!
r.read_body
p :body!
end
end
On 10-05-20 07:30 PM, Eric H. wrote:
On May 20, 2010, at 10:45, Xeno C. / Eskimo North and Gmail wrote:
Among other things we have built the tool around curl facilities like the --trace-time function, and we don’t want to mix in new stuff, or add variations in the kind of data we get. Also, all the switches for handling post data, HTTP headers, cookies, etc are working well, and it’s not clear you can do all of those things, let alone in a reasonably good way, with the net/http. I am certainly interested in your opinion on that.
Curl registers timestamps for points before the socket connection, as well as for receipt of each of the important HTTP headers, and then after the HTTP protocol activities are over the closure steps. Can I get that from net/http?
Yes. Here’s some pseudocode:
I’m sorry. That is not pertinent to what I said. Perhaps you should
learn curl.
On May 20, 2010, at 20:23, Xeno C. / Eskimo North and Gmail
wrote:
Curl registers timestamps for points before the socket connection, as well as for receipt of each of the important HTTP headers, and then after the HTTP protocol activities are over the closure steps. Can I get that from net/http?
Yes. Here’s some pseudocode:
I’m sorry. That is not pertinent to what I said. Perhaps you should learn curl.
You asked how to get timestamps using net/http for various things that
curl gives timestamps for. The pseudocode I answered with below shows
you exactly where to hook net/http to get those timestamps. I didn’t
think learning curl was required in order to get timestamps for various
stages of an HTTP request using net/http. Perhaps you should be more
specific in your requirements.
h = Net::HTTP.new
h.start do
p :connected!h.request do |r|
p :headers!
r.read_body
p :body!
end
end
PS: The Net::HTTP documentation explains how to do the following other
things you asked if net/http can do in ruby-talk:363103, “handling post
data, HTTP headers, cookies, etc”
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs