You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Marc MENDEZ <cn...@yahoo.fr> on 2006/08/29 08:16:54 UTC

[users@httpd] I'm worried...

Hi,

I use Apache2 on Mandrake 10.1.

I installed it recently. I build a simple web site which allows to download 
tips as PDF Files.
I created the original PDF Files on my computer. I can read them with no 
problem.
I transfered them to my website, first using Samba.
I notice then that some files could not be correctly read : IE tells me (or 
rather Adobe Acrobat plugin) that "The file does not start with '%PDF-'" ! I 
did the test on severeal computers...
Ok, I thought the files were corrupted. I transferted them again but with 
ftp... same problem !
I decided to transfert somewhere else the files on the same server, then I 
compared (using diff) each "bad" file with the new copy : no difference !!!

For heaven sake, what's wrong !! Argh !!!

Thanks for your support ! 


	
 p4.vert.ukl.yahoo.com uncompressed Tue Aug 29 05:27:00 GMT 2006 
	
		
___________________________________________________________________________ 
Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet ! 
Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos expériences. 
http://fr.answers.yahoo.com 


---------------------------------------------------------------------
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


Re: [users@httpd] I'm worried...

Posted by Marc MENDEZ <cn...@yahoo.fr>.
Hi,

I found some articles on the web. This problem has occurs since 2002 !! Yes 
!
But unfortunately, I could not find any article with a real solution !
For instance :
- Disable mod_deflate (obsolete anyway with 2.0.x)
- Upgrade to 2.0.40 (I have a 2.0.50)
- Comment in the magic file the line dealing with pdf
- Replace in the mime file application/pdf in application/x-pdf
- Some people said it happened with large pdf file (over 100kb) : for me, 
even a 78kb can't work !
- and certainly many other tips....

I did more tests :
Using wget (under Windows), I download the same file. I even save the file 
with the "Save Targer as" option....
I read the PDF file with an hex editor.... I promise you, it does not look 
like the original !!!! It's even ugly !!


After several attempts, I found THE solution !!

First, in the etc/magic (and maybe magic.default), comment the line :
0      string          %PDF-           application/pdf

Then, add this line in the httpd.conf file :
AddType application/x-pdf       pdf

Note that, instead of the last modification, I tried to edit the mime.types 
files. But, no effect. Only the "AddType" directive works!

Now, I will sleep better tonite... but I'd be interested if somebody could 
explain me the reason !!


Thanks !
----- Original Message ----- 
From: "Bing Du" <bd...@iastate.edu>
To: <us...@httpd.apache.org>
Sent: Tuesday, August 29, 2006 6:47 PM
Subject: Re: [users@httpd] I'm worried...


> Hi,
>
> I use Apache2 on Mandrake 10.1.
>
> I installed it recently. I build a simple web site which allows to
> download
> tips as PDF Files.
> I created the original PDF Files on my computer. I can read them with no
> problem.
> I transfered them to my website, first using Samba.
> I notice then that some files could not be correctly read : IE tells me
> (or
> rather Adobe Acrobat plugin) that "The file does not start with '%PDF-'" !
> I
> did the test on severeal computers...
> Ok, I thought the files were corrupted. I transferted them again but with
> ftp... same problem !
> I decided to transfert somewhere else the files on the same server, then I
> compared (using diff) each "bad" file with the new copy : no difference
> !!!
>
> For heaven sake, what's wrong !! Argh !!!
>
> Thanks for your support !

I don't think anything wrong with the PDF files themselves.  The problem
is they got compressed when they are transfered from the web server to the
browser.  Some browsers don't like it and hence the "The file does not
start with '%PDF-'"  error.  Google can tell more about that error.  We've
ever had that problem.  If the mod_deflate.so module is loaded in your
httpd configuration file, you can turn of compression for PDF files.  The
following config works for us.

===
# Turn on compression
<Location />
# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Or pdf
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

</Location>
===

Bing

---------------------------------------------------------------------
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


	
 p2.vert.ukl.yahoo.com uncompressed Tue Aug 29 16:27:01 GMT 2006 
	
		
___________________________________________________________________________ 
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com

---------------------------------------------------------------------
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


Re: [users@httpd] I'm worried...

Posted by Bing Du <bd...@iastate.edu>.
> Hi,
>
> I use Apache2 on Mandrake 10.1.
>
> I installed it recently. I build a simple web site which allows to
> download
> tips as PDF Files.
> I created the original PDF Files on my computer. I can read them with no
> problem.
> I transfered them to my website, first using Samba.
> I notice then that some files could not be correctly read : IE tells me
> (or
> rather Adobe Acrobat plugin) that "The file does not start with '%PDF-'" !
> I
> did the test on severeal computers...
> Ok, I thought the files were corrupted. I transferted them again but with
> ftp... same problem !
> I decided to transfert somewhere else the files on the same server, then I
> compared (using diff) each "bad" file with the new copy : no difference
> !!!
>
> For heaven sake, what's wrong !! Argh !!!
>
> Thanks for your support !

I don't think anything wrong with the PDF files themselves.  The problem
is they got compressed when they are transfered from the web server to the
browser.  Some browsers don't like it and hence the "The file does not
start with '%PDF-'"  error.  Google can tell more about that error.  We've
ever had that problem.  If the mod_deflate.so module is loaded in your
httpd configuration file, you can turn of compression for PDF files.  The
following config works for us.

===
# Turn on compression
<Location />
# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Or pdf
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

</Location>
===

Bing

---------------------------------------------------------------------
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