Problems sending binary data in cgi

perhaps

f.binmode

but i’m on unices so can’t test this.

-a

···

On 12 Feb 2003, Helmut Schottmueller wrote:

Hi there,

I’m trying to send binary data (e.g. gif file) to a web browser using
the following code:

f = File.open(gif_filename, “rb”)
content = f.read(filesize)
f.close

print “Content-type: image/gif\n\n”
print content

I’m using ruby for windows. I’m getting problems because every 0x0a
will be converted to 0x0d 0x0a. Must I use another method to print
binary data for output? I’ve found nothing in the ruby documentation.

====================================

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================

ahoward ahoward@fsl.noaa.gov wrote in message news:Pine.LNX.4.33.0302122251060.16097-100000@eli.fsl.noaa.gov

···

On 12 Feb 2003, Helmut Schottmueller wrote:

perhaps

f.binmode

but i’m on unices so can’t test this.

Hi Ara,

sorry, that’s not the problem. I’ve used f.binmode as well as
f.read(filename, “rb”) where b is for binary.

But thanks for your help.

Cheers,

Helmut