[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

HTTP doesn't work. A bug?

Bertram Scharpf

12/29/2004 11:44:00 PM

Hi all,

downloading a larger file, I encounter this error message:

/usr/lib/ruby/1.8/net/protocol.rb:197:in `sysread': End of file reached (EOFError)
from /usr/lib/ruby/1.8/net/protocol.rb:197:in `rbuf_fill'
from /usr/lib/ruby/1.8/net/protocol.rb:196:in `timeout'
from /usr/lib/ruby/1.8/timeout.rb:55:in `timeout'
from /usr/lib/ruby/1.8/net/protocol.rb:196:in `rbuf_fill'
from /usr/lib/ruby/1.8/net/protocol.rb:160:in `readuntil'
from /usr/lib/ruby/1.8/net/protocol.rb:171:in `readline'
from /usr/lib/ruby/1.8/net/http.rb:1554:in `read_status_line'
from /usr/lib/ruby/1.8/net/http.rb:1538:in `read_new'
from /usr/lib/ruby/1.8/net/http.rb:833:in `request'
from /usr/lib/ruby/1.8/net/http.rb:734:in `request_get'
from ./mautdaten.rb:154:in `getfile'
from ./mautdaten.rb:252:in `loadnewest'
from ./mautdaten.rb:354

The program below does a straight download without any
errors, but when the same code is integrated in a larger
program, I get the error message. Sorry, I didn't manage to
find out where the message disappears when shortening the
code.

The error happens only with a download through a modem. In
my small home network everything works properly. I use
Apache 1.3.26. Outside, I tried to load from 1.3.29 and 2.0
versions.

What do I have to to?

Bertram


----------------------------------------
#!/usr/bin/env ruby

class StopDownload < Exception
end

class StoreLoaded

def initialize( name, rfcdate, length)
require 'time'
lm = Time.httpdate rfcdate
if File.exist? name then
if lm <= File.ctime( name) and length == File.size( name) then
raise StopDownload
end
File.delete name
end
@fileobj = File.new name, 'w'
@fileobj.chmod 0444
end

def write( b)
@fileobj.write b
end

def << ( buf)
write buf
self
end

def flush
end

def close
@fileobj.close
freeze
end
end


class HTTPLoad

def initialize host
require 'net/http'
@conn = Net::HTTP.new host
end

def getfile( path, cls)
localfile = nil
@conn.request_get path do |resp|
if resp.code.to_i / 100 != 2 then
raise Error, "`%s\': %03d, %s" % [path, resp.code, resp.msg]
end
begin
localfile = cls.new 'localfile',
resp[ 'Last-Modified'], resp.content_length
resp.read_body do |buf|
localfile << buf
end
localfile.close
rescue StopDownload
end
end
localfile
end

end


if __FILE__ == $0
# The first site works always, the second only in this
# shortened example.
[['homer', '/another/maut/maut_55a.csv'],
['www.mauttabelle.de', '/maut_55a.csv']].each do |host,path|
c = HTTPLoad.new( host)
c.getfile path, StoreLoaded
end
end
----------------------------------------

--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-...


8 Answers

Bertram Scharpf

1/6/2005 10:43:00 PM

0

Hi,

Am Donnerstag, 30. Dez 2004, 08:43:52 +0900 schrieb Bertram Scharpf:
> Hi all,
>
> downloading a larger file, I encounter this error message:
>
> /usr/lib/ruby/1.8/net/protocol.rb:197:in `sysread': End of file reached (EOFError)
>
> The error happens only with a download through a modem. In
> my small home network everything works properly. I use
> Apache 1.3.26. Outside, I tried to load from 1.3.29 and 2.0
> versions.

I examined the problem thoroughly and now, I can reproduce
it reliably.

What I have to do is starting several instances of

wget -o /dev/null -O /dev/null http://www.ruby-doc.org/downloads/ruby-doc-bun...

Then, the program below dies when loading the first file the
second time.

I tried it with a maximum of debugging output, I even hacked
the interpreter to get some more. I diff'ed the results
against those of the run without the parallel downloads.
I didn't find any hint.

Of course, the program works when I omit the `conn.start'
statement, but I think it should get along with it.

The problem seems to be compiler-independent (GNU C 2.95
and 3.3).

Could anyone who knows more about socket connections please
have a look at the problem. I will provide any further
information.

Bertram


------------------------------

require 'net/http'

s, t = [ 'www.rayninfo.co.uk', 'www.ruby-doc.org']
f, g = [ '/vimtips.html', '/docs/CLR-FAQ/ruby_newsgroup_faq.txt']

c, d = [ s, t].collect { |host| Net::HTTP.new host }

[ c, d].each { |conn| conn.start }

100.times do |n|
[ [c,f], [d,g]].each do |conn,file|
conn.request_get file do |resp|
resp.read_body do |buf|
end
end
end
end


--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-...


Evelyn

3/15/2012 7:01:00 PM

0

On Thu, 15 Mar 2012 08:39:28 -0700 (PDT), maxwelton@my-deja.com wrote:

>On Mar 14, 6:34?pm, Evelyn <evelyn.r...@gmail.com> wrote:
>> On Wed, 14 Mar 2012 15:13:03 -0700, rumpelstiltskin
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> <rumpelstilts...@x.com> wrote:
>> >On Wed, 14 Mar 2012 14:25:20 -0400, Evelyn <evelyn.r...@gmail.com>
>> ><snip>
>>
>> >>Usenet has always been a bit of a shitfest. ? Either one can take it,
>> >>or one leaves. ? Frankly I sometimes enjoy it and sometimes not. ?I go
>> >>and come back as it suits me.
>>
>> >>Evelyn
>>
>> > ? I'm addicted, but fortunately I manage to keep it to
>> >this newsgroup. ?I did look back on alt.atheism a few
>> >days ago, but didn't see any familiar names from
>> >when I was posting there six or ten years ago
>> >Though I'm a devout supplicant of Athe, that group
>> >was too single-issue for me in the long run.
>>
>> I used to post there once in a while, but I left for pretty much the
>> same reason. ? As a Buddhist I do not have a central creator god type
>> icon in my belief system, but I am a ?spiritual minded individual in
>> the way that all Buddhists are. ? You don't need to believe in a god
>> to be a good person.
>
>I have had several people ask me if I were a Buddhist,
>and I would ask why they thought I was a Buddhist.
>This usually occurred after I had given someone some
>input or related a story. Some thought I was a student
>of Zen and it actually got me interested in learning about
>those things. I discovered I had been contemplating
>(or meditating) about dharma for years. In my adult
>life I have rejected the idea or organized religion.
>But I do consider myself a Christian and I find many
>parallels between the teachings of Christ and what
>is taught in Buddhism, things like love, forgiveness,
>karma, balance, ying and yang, etc. Beyond
>any spoken language there exists another
>language and it transcends any distortion that
>spoken language may present.


When I first became interested in Buddhism, I also remained a
christian. Eventually I realized that I was doing both religions a
disservice, in doing that. It is a bit more complex than I can
explain simply in a newsgroup posting, but I assure you that I
understand what you are saying and respect it.

I still have respect for the basic message of Jesus, (if he ever
existed) and as he has been reported to be. But the teachings of
Paul and all the rest of it, and most especially the violence and
cruelty that has become a part of the Christian message is just simply
and plainly wrong on a human level.

History bears me out from the Crusades to the Inquisition and the
witch and heretic burnings to the Pilgrims and the subjugation of
native populations wherever Christianity has spread its message.

Christianity and the bible are far too easily distorted by those who
would use religion to justify their cruelty. Buddhism leaves no room
for that. If it harms others, it is wrong.

Jesus died (presumably) after a few short years teaching during his
early 30's. Buddha lived well into his 80's leaving a vast body of
teachings and thousands of monks who learned from him directly, who
scrupulously passed the teachings on. I think he probably did a very
good job of weeding out the baloney.

I have saved quite a lot of buddhist scriptural quotes which exemplify
how he straightened out mistaken views during his lifetime of
teaching.

I also believe that one can achieve spiritual awakening from almost
any religion. They all reportedly have saints and wise men and women
who have struck others remarkably with their wisdom. It is a
personal journey and it isn't the color of the road or the sandals you
are wearing, but the journey itself and the effort made which
determines the result.

Whether accurately or innaccurately, I believe that Buddhism is simply
the most direct and clearest road map for that result.

Evelyn

maxwelton

3/15/2012 8:34:00 PM

0

On Mar 15, 3:01 pm, Evelyn <evelyn.r...@gmail.com> wrote:
> On Thu, 15 Mar 2012 08:39:28 -0700 (PDT), maxwel...@my-deja.com wrote:
> >On Mar 14, 6:34 pm, Evelyn <evelyn.r...@gmail.com> wrote:
> >> On Wed, 14 Mar 2012 15:13:03 -0700, rumpelstiltskin
>
> >> <rumpelstilts...@x.com> wrote:
> >> >On Wed, 14 Mar 2012 14:25:20 -0400, Evelyn <evelyn.r...@gmail.com>
> >> ><snip>
>
> >> >>Usenet has always been a bit of a shitfest.   Either one can take it,
> >> >>or one leaves.   Frankly I sometimes enjoy it and sometimes not.  I go
> >> >>and come back as it suits me.
>
> >> >>Evelyn
>
> >> >   I'm addicted, but fortunately I manage to keep it to
> >> >this newsgroup.  I did look back on alt.atheism a few
> >> >days ago, but didn't see any familiar names from
> >> >when I was posting there six or ten years ago
> >> >Though I'm a devout supplicant of Athe, that group
> >> >was too single-issue for me in the long run.
>
> >> I used to post there once in a while, but I left for pretty much the
> >> same reason.   As a Buddhist I do not have a central creator god type
> >> icon in my belief system, but I am a  spiritual minded individual in
> >> the way that all Buddhists are.   You don't need to believe in a god
> >> to be a good person.
>
> >I have had several people ask me if I were a Buddhist,
> >and I would ask why they thought I was a Buddhist.
> >This usually occurred after I had given someone some
> >input or related a story. Some thought I was a student
> >of Zen and it actually got me interested in learning about
> >those things. I discovered I had been contemplating
> >(or meditating) about dharma for years. In my adult
> >life I have rejected the idea or organized religion.
> >But I do consider myself a Christian and I find many
> >parallels between the teachings of Christ and what
> >is taught in Buddhism, things like love, forgiveness,
> >karma, balance, ying and yang, etc. Beyond
> >any spoken language there exists another
> >language and it transcends any distortion that
> >spoken language may present.
>
> When I first became interested in Buddhism, I also remained a
> christian.   Eventually I realized that I was doing both religions a
> disservice, in doing that.   It is a bit more complex than I can
> explain simply in a newsgroup posting, but I assure you that I
> understand what you are saying and respect it.
>
> I still have respect for the basic message of Jesus, (if he ever
> existed) and as he has been reported to be.   But the teachings of
> Paul and all the rest of it, and most especially the violence and
> cruelty that has become a part of the Christian message is just simply
> and plainly wrong on a human level.
>
> History bears me out from the Crusades to the Inquisition and the
> witch and heretic burnings to the Pilgrims and the subjugation of
> native populations wherever Christianity has spread its message.
>
> Christianity and the bible are far too easily distorted by those who
> would use religion to justify their cruelty.   Buddhism leaves no room
> for that.   If it harms others, it is wrong.

I agree with what you are saying, but I really
believe it has a lot to do with western culture.
It accepts Christ but won't conform to the teachings
of Christ. Much more cruelty existed in the west
long before Christ brought his message. The
difference now is that it is wrapped in the cross.
We know about the violence and intolerance
that exist today in the mideast between the
Muslims and Jews.
Compared to the people in the far east, Jews and
Muslims are very similar and as you may know
they share a common history. Christ happened
to be born a Jew, but, it was as if Christ was a
lone alien in a foreign land and it was hard for the
people to understand his message and they
decided they wanted him dead.

>
> Jesus died (presumably) after a few short years teaching during his
> early 30's.   Buddha lived well into his 80's leaving a vast body of
> teachings and thousands of monks who learned from him directly, who
> scrupulously passed the teachings on.   I think he probably did a very
> good job of weeding out the baloney.

Far east culture seems so much older and somewhat
advanced compared to the west. As
you know Christianity has a lot of *blanks* in it. No one
knows for instance where Jesus was from the time he
was a boy until the time he returned at around the age
of 30. Myself as well as others have wondered if he
had ventured to the east. I understand that Buddhism
had spread west into Afghanistan before the 6th century.
Only fairly recently have the Buddhist statues been destroyed
by the Taliban in Afghanistan. In those days people
were so disconnected that no one knew what people
a few hundred miles away were learning and doing.
Another thing was no one knows about the culture
of the magi that came from the east when Jesus
was born. Following signs and looking for a newborn
isn't too far removed from the Buddhist practice.
I haven't heard of Jews or Muslims ever doing that.
>
> I have saved quite a lot of buddhist scriptural quotes which exemplify
> how he straightened out mistaken views during his lifetime of
> teaching.
>
> I also believe that one can achieve spiritual awakening from almost
> any religion.   They all reportedly have saints and wise men and women
> who have struck others remarkably with their wisdom.   It is a
> personal journey and it isn't the color of the road or the sandals you
> are wearing, but the journey itself and the effort made which
> determines the result.
>
> Whether accurately or innaccurately, I believe that Buddhism is simply
> the most direct and clearest road map for that result.
>
> Evelyn

Evelyn

3/16/2012 12:29:00 AM

0

On Thu, 15 Mar 2012 13:33:43 -0700 (PDT), maxwelton@my-deja.com wrote:

>On Mar 15, 3:01?pm, Evelyn <evelyn.r...@gmail.com> wrote:
>> On Thu, 15 Mar 2012 08:39:28 -0700 (PDT), maxwel...@my-deja.com wrote:
>> >On Mar 14, 6:34?pm, Evelyn <evelyn.r...@gmail.com> wrote:
>> >> On Wed, 14 Mar 2012 15:13:03 -0700, rumpelstiltskin
>>
>> >> <rumpelstilts...@x.com> wrote:
>> >> >On Wed, 14 Mar 2012 14:25:20 -0400, Evelyn <evelyn.r...@gmail.com>
>> >> ><snip>
>>
>> >> >>Usenet has always been a bit of a shitfest. ? Either one can take it,
>> >> >>or one leaves. ? Frankly I sometimes enjoy it and sometimes not. ?I go
>> >> >>and come back as it suits me.
>>
>> >> >>Evelyn
>>
>> >> > ? I'm addicted, but fortunately I manage to keep it to
>> >> >this newsgroup. ?I did look back on alt.atheism a few
>> >> >days ago, but didn't see any familiar names from
>> >> >when I was posting there six or ten years ago
>> >> >Though I'm a devout supplicant of Athe, that group
>> >> >was too single-issue for me in the long run.
>>
>> >> I used to post there once in a while, but I left for pretty much the
>> >> same reason. ? As a Buddhist I do not have a central creator god type
>> >> icon in my belief system, but I am a ?spiritual minded individual in
>> >> the way that all Buddhists are. ? You don't need to believe in a god
>> >> to be a good person.
>>
>> >I have had several people ask me if I were a Buddhist,
>> >and I would ask why they thought I was a Buddhist.
>> >This usually occurred after I had given someone some
>> >input or related a story. Some thought I was a student
>> >of Zen and it actually got me interested in learning about
>> >those things. I discovered I had been contemplating
>> >(or meditating) about dharma for years. In my adult
>> >life I have rejected the idea or organized religion.
>> >But I do consider myself a Christian and I find many
>> >parallels between the teachings of Christ and what
>> >is taught in Buddhism, things like love, forgiveness,
>> >karma, balance, ying and yang, etc. Beyond
>> >any spoken language there exists another
>> >language and it transcends any distortion that
>> >spoken language may present.
>>
>> When I first became interested in Buddhism, I also remained a
>> christian. ? Eventually I realized that I was doing both religions a
>> disservice, in doing that. ? It is a bit more complex than I can
>> explain simply in a newsgroup posting, but I assure you that I
>> understand what you are saying and respect it.
>>
>> I still have respect for the basic message of Jesus, (if he ever
>> existed) and as he has been reported to be. ? But the teachings of
>> Paul and all the rest of it, and most especially the violence and
>> cruelty that has become a part of the Christian message is just simply
>> and plainly wrong on a human level.
>>
>> History bears me out from the Crusades to the Inquisition and the
>> witch and heretic burnings to the Pilgrims and the subjugation of
>> native populations wherever Christianity has spread its message.
>>
>> Christianity and the bible are far too easily distorted by those who
>> would use religion to justify their cruelty. ? Buddhism leaves no room
>> for that. ? If it harms others, it is wrong.
>
>I agree with what you are saying, but I really
>believe it has a lot to do with western culture.
>It accepts Christ but won't conform to the teachings
>of Christ. Much more cruelty existed in the west
>long before Christ brought his message. The
>difference now is that it is wrapped in the cross.
>We know about the violence and intolerance
>that exist today in the mideast between the
>Muslims and Jews.
>Compared to the people in the far east, Jews and
>Muslims are very similar and as you may know
>they share a common history. Christ happened
>to be born a Jew, but, it was as if Christ was a
>lone alien in a foreign land and it was hard for the
>people to understand his message and they
>decided they wanted him dead.
>
>>
>> Jesus died (presumably) after a few short years teaching during his
>> early 30's. ? Buddha lived well into his 80's leaving a vast body of
>> teachings and thousands of monks who learned from him directly, who
>> scrupulously passed the teachings on. ? I think he probably did a very
>> good job of weeding out the baloney.
>
>Far east culture seems so much older and somewhat
>advanced compared to the west. As
>you know Christianity has a lot of *blanks* in it. No one
>knows for instance where Jesus was from the time he
>was a boy until the time he returned at around the age
>of 30. Myself as well as others have wondered if he
>had ventured to the east. I understand that Buddhism
>had spread west into Afghanistan before the 6th century.
>Only fairly recently have the Buddhist statues been destroyed
>by the Taliban in Afghanistan. In those days people
>were so disconnected that no one knew what people
>a few hundred miles away were learning and doing.
>Another thing was no one knows about the culture
>of the magi that came from the east when Jesus
>was born. Following signs and looking for a newborn
>isn't too far removed from the Buddhist practice.
>I haven't heard of Jews or Muslims ever doing that.
>>
>> I have saved quite a lot of buddhist scriptural quotes which exemplify
>> how he straightened out mistaken views during his lifetime of
>> teaching.
>>
>> I also believe that one can achieve spiritual awakening from almost
>> any religion. ? They all reportedly have saints and wise men and women
>> who have struck others remarkably with their wisdom. ? It is a
>> personal journey and it isn't the color of the road or the sandals you
>> are wearing, but the journey itself and the effort made which
>> determines the result.
>>
>> Whether accurately or innaccurately, I believe that Buddhism is simply
>> the most direct and clearest road map for that result.
>>
>> Evelyn


Buddha lived about 500 years before Jesus, and his teachings had
spread quite a bit by then. There is a tradition that says Jesus
lived in India till he reached the age when he began to teach. There
is a temple in India that is dedicated to him.

Evelyn

rumpelstiltskin

3/16/2012 2:58:00 AM

0

On Thu, 15 Mar 2012 13:33:43 -0700 (PDT), maxwelton@my-deja.com wrote:
>On Mar 15, 3:01?pm, Evelyn <evelyn.r...@gmail.com> wrote:
<snip>



>> Jesus died (presumably) after a few short years teaching during his
>> early 30's. ? Buddha lived well into his 80's leaving a vast body of
>> teachings and thousands of monks who learned from him directly, who
>> scrupulously passed the teachings on. ? I think he probably did a very
>> good job of weeding out the baloney.
>
>Far east culture seems so much older and somewhat
>advanced compared to the west. As
>you know Christianity has a lot of *blanks* in it. No one
>knows for instance where Jesus was from the time he
>was a boy until the time he returned at around the age
>of 30. Myself as well as others have wondered if he
>had ventured to the east.



It's possible, but you don't even have to go
that far. Zoroastrianism was flourishing in
Iran. There are only a couple of hundred
thousand Zoroastrians nowadays, centered
on the Northwestern Corner of Iran. In my
last job I worked with a guy from that region
and he was a Zoroastrian. I don't know
anything to speak of about the religion, but
it's regarded as one of the major influences
on the Abrahamic religions, being older than
they are. (I hope it's "better" than they are.)



Sordo

3/16/2012 4:36:00 PM

0

On Thu, 15 Mar 2012 15:01:24 -0400, Evelyn <evelyn.ruut@gmail.com>
wrote:


>I have saved quite a lot of buddhist scriptural quotes which exemplify
>how he straightened out mistaken views during his lifetime of
>teaching.
>
>I also believe that one can achieve spiritual awakening from almost
>any religion. They all reportedly have saints and wise men and women
>who have struck others remarkably with their wisdom. It is a
>personal journey and it isn't the color of the road or the sandals you
>are wearing, but the journey itself and the effort made which
>determines the result.
>
>Whether accurately or innaccurately, I believe that Buddhism is simply
>the most direct and clearest road map for that result.
>
>Evelyn

"Thou shalt not proselytize"

___

"Proud To Be Everything Liberals Hate"

Evelyn

3/16/2012 6:39:00 PM

0

On Fri, 16 Mar 2012 09:35:50 -0700, Sordo <sordo@true.news.org> wrote:

>On Thu, 15 Mar 2012 15:01:24 -0400, Evelyn <evelyn.ruut@gmail.com>
>wrote:
>
>
>>I have saved quite a lot of buddhist scriptural quotes which exemplify
>>how he straightened out mistaken views during his lifetime of
>>teaching.
>>
>>I also believe that one can achieve spiritual awakening from almost
>>any religion. They all reportedly have saints and wise men and women
>>who have struck others remarkably with their wisdom. It is a
>>personal journey and it isn't the color of the road or the sandals you
>>are wearing, but the journey itself and the effort made which
>>determines the result.
>>
>>Whether accurately or innaccurately, I believe that Buddhism is simply
>>the most direct and clearest road map for that result.
>>
>>Evelyn
>
>"Thou shalt not proselytize"
>
>___
>
>"Proud To Be Everything Liberals Hate"


Actually, I don't proselytize, and you might want to look up the word
to be certain. I might make reference to something or other as I see
fit. In that case just skip my posts, because I don't take orders
from you or those like you.

Evelyn

Evelyn

3/16/2012 6:48:00 PM

0

On Fri, 16 Mar 2012 09:35:50 -0700, Sordo <sordo@true.news.org> wrote:

>On Thu, 15 Mar 2012 15:01:24 -0400, Evelyn <evelyn.ruut@gmail.com>
>wrote:
>
>
>>I have saved quite a lot of buddhist scriptural quotes which exemplify
>>how he straightened out mistaken views during his lifetime of
>>teaching.
>>
>>I also believe that one can achieve spiritual awakening from almost
>>any religion. They all reportedly have saints and wise men and women
>>who have struck others remarkably with their wisdom. It is a
>>personal journey and it isn't the color of the road or the sandals you
>>are wearing, but the journey itself and the effort made which
>>determines the result.
>>
>>Whether accurately or innaccurately, I believe that Buddhism is simply
>>the most direct and clearest road map for that result.
>>
>>Evelyn
>
>"Thou shalt not proselytize"
>
>___
>
>"Proud To Be Everything Liberals Hate"


Actually, I don't proselytize, and you might want to look up the word
to be certain. I might make reference to something or other as I see
fit. In that case just skip my posts, because I don't take orders
from you or those like you.

Evelyn