From: Robert Klemme on
2010/5/20 Xeno Campanoli / Eskimo North and Gmail <xeno.campanoli(a)gmail.com>:
> On 10-05-20 02:37 AM, Robert Klemme wrote:
>>
>> 2010/5/19 Xeno Campanoli / Eskimo North and
>> Gmail<xeno.campanoli(a)gmail.com>:
>>>
>>> On 10-05-18 04:28 PM, Xeno Campanoli / 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
>
> 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

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

From: Eric Hodel on
On May 20, 2010, at 20:23, Xeno Campanoli / 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"