[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

too slow in using Net::HTTP.post_form

Ak 756

8/13/2007 9:53:00 AM

Hi

I am using Net::HTTP.post_form to post cgi request to a website and get
answers.
Below is my code and I found that it always take about 30s to return the
result. I think my Internt connection is not so slow as I paste the same
cgi request url and run in my firefox, it will get result in less then
10 second.

puts Time.now
post_result= Net::HTTP.post_form(URI.parse(url),params)
puts Time.now

So, how can I make the post_form returns quickly?
And, I also found many tags like <img src=xxx.gif> in the returned html
file. Did the post_form download all those gif files? If so, how can I
discard all the image file and only get the text result?

Thanks in advance.

ak
--
Posted via http://www.ruby-....

5 Answers

Ak 756

8/14/2007 12:37:00 AM

0

So bad, no one can give me some hint?
--
Posted via http://www.ruby-....

John Joyce

8/14/2007 12:47:00 AM

0


On Aug 13, 2007, at 7:37 PM, Ak 756 wrote:

> So bad, no one can give me some hint?
> --
> Posted via http://www.ruby-....
>
You might post more of the code.


Lionel Bouton

8/14/2007 10:56:00 AM

0

Ak 756 wrote the following on 13.08.2007 11:52 :
> Hi
>
> I am using Net::HTTP.post_form to post cgi request to a website and get
> answers.
> Below is my code and I found that it always take about 30s to return the
> result. I think my Internt connection is not so slow as I paste the same
> cgi request url and run in my firefox, it will get result in less then
> 10 second.
>
> puts Time.now
> post_result= Net::HTTP.post_form(URI.parse(url),params)
> puts Time.now
>
> So, how can I make the post_form returns quickly?
>

Maybe the particular server you are testing reacts differently if you
don't have a session, a referer or the right user-agent ?

> And, I also found many tags like <img src=xxx.gif> in the returned html
> file. Did the post_form download all those gif files?

No, it didn't.

Ak 756

8/15/2007 1:28:00 AM

0

Lionel Bouton wrote:
> Ak 756 wrote the following on 13.08.2007 11:52 :
>> post_result= Net::HTTP.post_form(URI.parse(url),params)
>> puts Time.now
>>
>> So, how can I make the post_form returns quickly?
>>
>
> Maybe the particular server you are testing reacts differently if you
> don't have a session, a referer or the right user-agent ?
>
>> And, I also found many tags like <img src=xxx.gif> in the returned html
>> file. Did the post_form download all those gif files?
>
> No, it didn't.

Hi

Below is my code:
----------------------------------------------------------
require 'net/http'

params = {'s'=>'GOOG'}
url='http://finance.yahoo....
puts Time.now
post_result= Net::HTTP.post_form(URI.parse(url),params)
puts Time.now
----------------------------------------------------------

And its running result:
Wed Aug 15 09:11:48 +0800 2007
Wed Aug 15 09:12:02 +0800 2007

I think this is slow since the post_form will not downloading pictures
in the post reply page. And when I type the url
'http://finance.yahoo.com/q?s... in my firefox , it will show the
complete page including pictures in about 10s. If I configure the
firefox to not download pictures, it need only 4s. So,how I can I make
post_form reply more fast?
--
Posted via http://www.ruby-....

Chris Carter

8/15/2007 1:34:00 AM

0

On 8/14/07, Ak 756 <macro.peng@gmail.com> wrote:
> And its running result:
> Wed Aug 15 09:11:48 +0800 2007
> Wed Aug 15 09:12:02 +0800 2007
>
> I think this is slow since the post_form will not downloading pictures
> in the post reply page. And when I type the url
> 'http://finance.yahoo.com/q?s... in my firefox , it will show the
> complete page including pictures in about 10s. If I configure the
> firefox to not download pictures, it need only 4s. So,how I can I make
> post_form reply more fast?

The same code takes less than a second for me. Perhaps it is your connection?


--
Chris Carter
concentrationstudios.com
brynmawrcs.com