Serving binary data from a cgi-script

T

Thomas W

Hi,

I'm having some problems serving binary data in a simple CGI-script.
I'm setting content-type ( "application/octet-stream" ), content-length
and Content-disposition and I think these are correct, but the size of
the served file/data is different than the source. The read and write
the data I'm doing a plain :

f = open (..., 'rb')
d = f.read(2048)
while d:
if not d: break
print d
d = f.read(2048)
f.close()

Any hints?

Best regards,
Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top