apache module - how to send a binary file

apache module - how to send a binary file

Post by Bryan Whit » Thu, 06 Aug 1998 04:00:00



I have an apache module that needs to send a binary file (A Windows .EXE
file).  I have been able to send this file to both Netscape 4.0 and MSIE 4.0
with one small problem.  MSIE does not get the name of the file.  This is to
be the default name presented when the user chooses to save.  MSIE presents
a somewhat random sequence of characters.

I looked in RFC 1945 and rfc 2068 but found no documentation as to how to do
this.  I guessed at using the same headers I have used when sending
attachements via email.  As I said netscape 4.0 figured it out.

Here is a code fragement:

r->content_type = "application/octet-stream; filename=\"GOPlayMe.exe\"";
table_set(r->headers_out,"Content-Length",itoa(totchunklen));
table_set(r->headers_out,"Transfer-Encoding","binary");

table_set(r->headers_out,"Content-Disposition","filename=\"GOPlayMe.exe\"");
send_http_header(r);

This is followed by a set of rwrite() calls to send the body of the message.

As a side question: Is "binary" the preferred encoding format here or should
I be using "base64"?  Also do I have to do anything different for HTTP 1.0
browsers or "chunked" requests?  I am a little vague on whether is is the
client of ther server that specifies "chunked".

--
Bryan White
ArcaMax
www.arcamax.com
Madness is a sign of the times.
You must learn to embrace it,
let it inspire you.

 
 
 

1. apache module - how to send a binary file

This might not be the right group for this question but http and/or apache
do not have there own groups (or I have not found them).

I have an apache module that needs to send a binary file (A Windows .EXE
file).  I have been able to send this file to both Netscape 4.0 and MSIE 4.0
with one small problem.  MSIE does not get the name of the file.  This is to
be the default name presented when the user chooses to save.  MSIE presents
a somewhat random sequence of characters.

I looked in RFC 1945 and rfc 2068 but found no documentation as to how to do
this.  I guessed at using the same headers I have used when sending
attachements via email.  As I said netscape 4.0 figured it out.

Here is a code fragement:

 r->content_type = "application/octet-stream; filename=\"GOPlayMe.exe\"";
 table_set(r->headers_out,"Content-Length",itoa(totchunklen));
 table_set(r->headers_out,"Transfer-Encoding","binary");

table_set(r->headers_out,"Content-Disposition","filename=\"GOPlayMe.exe\"");
 send_http_header(r);

This is followed by a set of rwrite() calls to send the body of the message.

As a side question: Is "binary" the preferred encoding format here or should
I be using "base64"?  Also do I have to do anything different for HTTP 1.0
browsers or "chunked" requests?  I am a little vague on whether is is the
client of ther server that specifies "chunked".

--
Bryan White
ArcaMax
www.arcamax.com
Madness is a sign of the times.
You must learn to embrace it,
let it inspire you.

2. setting name server

3. Help - Sending binary file by CGI (file extension problem in "i.e.")

4. Again the calculator

5. Sending binary file by CGI (file extension problem in "i.e.")

6. Repost: Kernel panic while mounting/release date?

7. Apache served binaries files not recognised by browser as binary, but displayed

8. Does anybody understand this?

9. Sending XML data to Apache web server and capturing this sent data from the Apache server

10. Sending uploaded files from one Apache WebServer to another Apache WebServer

11. Sending binary data using send(2)

12. Send and receive binary files with sockets

13. Sending binary files using mail