eRuby 1.0.4 truncated content problem

Hi all,

I have a very difficult to trace-down problem with

   - Apache 1.3.20 (Win32)
   - eRuby version 1.0.4
   - ruby 1.8.2 (2004-07-29) [i386-mswin32]

Currently it seems I ran out of options, so I thought I post it.
Here it is.

When I query the script foo.cgi (yes, it's a CGI -- no mod_ruby
involved; for reasons why is a different story)

···

==================================================
#!/ruby/bin/eruby
<HTML>
<BODY>

% 1.upto(1000) { |x|
   <%= x %>,
% }

</BODY>
</HTML>

with

#!/ruby/bin/ruby
require 'net/http'

h = Net::HTTP.new('localhost', 80)
resp, data = h.get('/foo.cgi', nil )
puts "Code = #{resp.code}"
puts "Message = #{resp.message}"
resp.each {|key, val| printf "%17s = %-40.40s\n", key, val }

puts
p data[-50..-1]

puts
p data.length

I get

Code = 200
Message = OK
       connection = close
     content-type = text/html; charset=iso-8859-1
             date = Wed, 15 Sep 2004 20:02:16 GMT
           server = Apache/1.3.20 (Win32)
   content-length = 7926

" 886,\r\n 887,\r\n 888,\r\n 889,\r\n 890,\r\n 891"

7926

In other words, the content gets truncated, and I suspect
that either eRuby or Apache does not incorporate the Win2
carriage returns in the content-length count.

This is a weird problem to me because the apache/eRuby/ruby combo
works fine on two other machines, which both happen to be Win2000.
On those machines, the output is like

Code = 200
Message = OK
       connection = close
     content-type = text/html; charset=iso-8859-1
             date = Wed, 15 Sep 2004 20:02:16 GMT
           server = Apache/1.3.20 (Win32)
   content-length = [some number]

" 998,\n 999,\n 1000, \n</BODY>\n\n</HTML>\n"

[same number]

i.e., without the carriage returns and full content. The present machine
is installed with WinXP which is firewalled as opposed to the other two
machines. (Dunno if that's relevant, probably not.)

I've tested with Apache 2.0.50 --- same problem.

Any ideas?

Thanks.

* Gerard A.W. Vreeswijk <gv@cs.uu.nl> [0954 09:54]:

Hi all,

I have a very difficult to trace-down problem with

   - Apache 1.3.20 (Win32)
   - eRuby version 1.0.4
   - ruby 1.8.2 (2004-07-29) [i386-mswin32]

Currently it seems I ran out of options, so I thought I post it.
Here it is.

When I query the script foo.cgi (yes, it's a CGI -- no mod_ruby
involved; for reasons why is a different story)

Tried just 'erby foo.cgi' ? That might narrow it down to apache/eruby.

···

--
Death to all fanatics!
Rasputin :: Jack of All Trades - Master of Nuns

I suppose you mean 'eruby' ? Forgot to mention that, sorry. In the test
process I indeed tried what eruby did with foo.cgi on the command line,
with this result:

···

On Thu, 16 Sep 2004 18:28:40 +0900, in comp.lang.ruby you wrote:

Tried just 'erby foo.cgi' ? That might narrow it down to apache/eruby.
--

===================================================
$ d:\sw\bin\eruby foo.cgi | tail
   995,
   996,
   997,
   998,
   999,
   1000,

</BODY>
</HTML>

$ _

Gee! This indeed makes it even more mysterious to me.

All three installations run with Apache 1.3.20/eRuby 1.0.4. I even copied
the http.conf from one machine into the conf-dir of the new machine!
The only difference is that, on the new machine, Apache runs as a service,
but this is probably irrelevant as well.

NB. got eRuby from
http://www.ibiblio.org/pub/languages/ruby/binaries/mswin32/ext/eruby-1.0.4-i386-mswin32-1.8.zip

Thanks.

Compiled eRuby 1.0.5 under MinGW:

$ /c/mingw/usr/local/bin/eruby --version
eRuby version 1.0.5
ruby 1.8.2 (2004-09-06) [i386-mingw32]
$ _

Here the truncation problem does not occur. Still, I wonder why this
all happened with the mswin32 build of ruby/eruby.

But at least I can now continue development at home at a Win32 box.