Bug#257945: davs...

2010-01-28 Thread Stefan Fritsch
On Wednesday 27 January 2010, Andreas J. Guelzow wrote:
 The php5.conf file attaches a mime-type via a FileMatch. That
  appears to override ForceType.
 
 In php4.conf the extension was mapped to a type. That works fine
  with ForceType.
 
 So by usingthe phpo4 version of attaching the extensions to the
 mime-type/handler for php5, ForceType works again in the dav setup
  and it is trivial to have php files served via dav asif they were
  text.
 
 See the complex configuration section of
 http://httpd.apache.org/docs/2.2/mod/mod_dav.html

This is a mess. IMHO it is mod_dav's job to ensure that the file 
contents is sent and not the script output. But it doesn't do that.


So when does mod_php execute a script?

Case 1: the handler is set to application/x-httpd-php

This is done be the current mod_php5 default config in php5.conf. You 
can unset the handler with:

   SetHandler none


Case 2: the handler is unset and the content type is application/x-
httpd-php

This is done by the entry

application/x-httpd-php phtml pht php

in /etc/mime.types (or by the old default config in 
php4.conf/php5.conf before php5 5.2.11.dfsg.1-2).

There are several ways to undo this:
- use ForceType
- remove the line from /etc/mime.types
- since apache2 2.2.14-2, you can also use
RemoveType phtml pht php


This gives you a lot of ways how to create a working configuration.


The one corresponding to your previous config would be

Location /dav
  Dav on
  SetHandler none
  ForceType text/plain
/Location


The most sane one for apache2 = 2.2.14-2 would be

RemoveType phtml pht php phps
Location /dav
  Dav on
  SetHandler none
/Location


A rather curious (but definitely not recommended) way is

Location /dav
  Dav on
  SetHandler mod-dav-is-strange
/Location

If the handler is set, the content-type is not relevant. And if the 
set handler does not exist, the request is handled by the default 
handler (at least in this case). (The fixed handler also means that 
mod_autoindex won't handle directories.)


I will suggest upstream that mod_dav is changed to do the right thing 
without additional configuration.

Cheers,
Stefan



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#257945: davs...

2010-01-26 Thread Andreas J. Guelzow
The php5.conf file attaches a mime-type via a FileMatch. That appears to
override ForceType. 

In php4.conf the extension was mapped to a type. That works fine with
ForceType. 

So by usingthe phpo4 version of attaching the extensions to the
mime-type/handler for php5, ForceType works again in the dav setup and
it is trivial to have php files served via dav asif they were text.

See the complex configuration section of
http://httpd.apache.org/docs/2.2/mod/mod_dav.html

Andreas
-- 
Andreas J. Guelzow aguel...@pyrshep.ca




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org