I'm trying to implement a small WebDAV server using PHP. (WebDAV is an HTTP

extension that (among other things) makes it possible to manage files using

the HTTP protocol; kinda in the same way like using FTP through a

web-browser.)


I've made a short index.php file which is automatically run when then target

directory is accessed using a browser; so, if I try to browse

[url]http://mysite.com/webdav/[/url], [url]http://mysite.com/webdav/index.php[/url] is executed.


Inside index.php I have the following logic:

[...]

switch ( $_SERVER["REQUEST_METHOD"] )

{

// List contents of current directory.

case "PROPFIND":

{

// Code for doing directory listing goes here.

}break;

// Options:

case "OPTIONS":

{

// Send a specific reply / identify ourself.

}break;

// GET/Download file

case "GET":

{

// Code for sending a file to the client goes here.

}break;

[...etc...]

}

[...]


When I try to use M$ Internet Explorer to access [url]http://mysite.com/webdav/[/url]

(the index.php file is executed), the following lines are added to apache's

access.log:


10.0.2.164 - - [28/Jul/2003:16:30:26 +0200] "GET /_vti_inf.html HTTP/1.1"
404

285 "-" "Mozilla/2.0 (compatible; MS FrontPage 5.0)"

10.0.2.164 - - [28/Jul/2003:16:30:26 +0200] "POST
/_vti_bin/shtml.exe/_vti_rpc

HTTP/1.1" 404 299 "-" "MSFrontPage/5.0"

10.0.2.164 - - [28/Jul/2003:16:30:26 +0200] "OPTIONS / HTTP/1.1" 200 - "-"

"Microsoft Data Access Internet Publishing Provider Protocol Discovery"

10.0.2.164 - - [28/Jul/2003:16:30:26 +0200] "OPTIONS /webdav HTTP/1.1" 400
293

"-" "Microsoft Data Access Internet Publishing Provider Protocol Discovery"


Forget the first two lines (this is just some M$ specific stuff), the third

line is also unimportant since the server automatically replies with HTTP
OK.

The last line is the problem: My script needs to reply with some specific

headers when the client sends an OPTION request (in order to identify
itself).

However, the "OPTIONS" case (inside switch ( $_SERVER["REQUEST_METHOD"] ))
of

my script never gets executed (GET, PROPFIND, etc. works). Could it be that

Apache is not sending the OPTIONS requests to the PHP-script itself? If so,

how can I make it do this?