You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Neal Rhodes <ne...@dexter.mnopltd.com> on 2003/04/02 22:27:09 UTC

Re: [users@httpd] How to send Binary Files Inline?

Thanks for the reply.   I did the switch to the native redhat 1.3.27
apache, and the other changes noted.  Now my output looks like...

Content-Type: application/pdf^M
Content-disposition: filename=ny000473_speccase_1_1.pdf^M

%PDF-1.2
%Gl~O"
6 0 obj
<</Length 7 0 R/Filter /FlateDecode>>
stream

But we still get...
[Wed Apr  2 14:07:50 2003] [error] [client 209.124.77.249] malformed header 
from script. Bad header=Binary file (standard input) m: /usr/appl/cgi/bdny

I tossed in your " Transfer-Encoding: chunked" in the interest of science, 
but that didn't do anything either. 

Now, PHP is a module, right?  And that's different from apache invoking 
a separate cgi script and reading its StdOut. 

NOW HERE'S THE interesting thing - If I replace the actual .pdf file
with a plain text file that begins with the line %PDF-, then apache is
completely happy.  Of course Acrobat is not really thrilled, but that's
to be expected. 

On Wed, Apr 02, 2003 at 12:32:17PM -0500, Jacob Coby wrote:
> > Clearly we need to do SOMETHING else to keep apache happy, but we're
> > at a loss to figure out what.  Any ideas?
> 
> 1) put a space after the colon in the Content-type header
> 2) take out the attachment clause to Content-Disposition
> 3) upgrade apache to 1.3.27.  This issue may be a bug and already be
> adressed.
> 
> We're doing an analagous thing here, but through php.  The returned headers
> look like:
> 
> HTTP/1.1 200 OK
> Date: Wed, 02 Apr 2003 17:28:30 GMT
> Server: Apache/1.3.27 (Unix) PHP/4.2.3 mod_ssl/2.8.11 OpenSSL/0.9.6g
> X-Powered-By: PHP/4.2.3
> X-Accelerated-By: PHPA/1.3.3r1
> Content-Disposition: filename="useful.txt"
> Transfer-Encoding: chunked
> Content-Type: text/plain
> 
> And the only thing being done on the PHP side is:
> 
> header("Content-type: ".$blob["mime_type"]);
> header("Content-Disposition: filename=\"$filename\"");
> echo $blob["binary_data"];
> 
> -Jacob
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

-- 
============================================================================
Neal Rhodes                    MNOP Ltd                       (770) 972-5430
President                  4737 Habersham Ridge         fax:  (770) 978-4741
                          Lilburn (atlanta) GA 30047    

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org