/ Zope / Apsis / Pound Mailing List / Archive / 2006 / 2006-07 / WebDAV config [patch]

[ << ] [ >> ]

[ SVN copy patch / Florian Wagner ... ] [ inet_ntoa not thread-safe / Jacques Caron ... ]

WebDAV config [patch]
Adam Borowski <kilobyte(at)angband.pl>
2006-07-01 02:35:11 [ FULL ]
Hello!

It would be really a shame to have 2.1 force people to recompile just
to get working WebDAV.  While it's not a real hoop for people
installing pound from source, those who use distro-provided packages
will have to look around.

Also, another problem is that --enable-msdav enables not just WebDAV
but a bunch of proprietary M$ extensions as well.  This is not what
an average user wants.


An obvious fix would be to change the #define to a config-file
option.  It modifies just a single line in the code anyway.  However,
I went further -- this patch distinguishes between 4 levels:

## WebDAV
##      0       disabled
##      1       fake (nothing but LOCK and UNLOCK)
##      2       enabled (partial RFC compliance, implies xHTTP)
##      3       MSDAV (Microsoft extensions)

I can't really find out what enabling just LOCK and UNLOCK would be
good for; it doesn't hurt to preserve this option, though.  Setting
WebDAV to 3 will work the same as --enable-msdav does right now, and
setting it to 2 will turn all non-MS-only methods that pound knows.

I believe that having "2" separate from "3" is quite a good idea --
at least grepping the logs for "CONNECT" can be telling :p


Cheers and schtuff,[...]
Attachments:  
pound-webdav.patch text/plain 8152 Bytes

Re: [Pound Mailing List] WebDAV config [patch]
Adam Borowski <kilobyte(at)angband.pl>
2006-07-01 02:47:03 [ FULL ]
Aargh!  It looks like the list software you guys use rips away any
attachments.  Here's the patch again:

diff -Nurd Pound-2.0.9/config.c pound/config.c
--- Pound-2.0.9/config.c	2006-06-23 14:10:59.000000000 +0200
+++ pound/config.c	2006-07-01 02:01:58.182251500 +0200
(at)(at) -918,7 +918,7 (at)(at)
     || regcomp(&Port, "^[ \t]*Port[ \t]+([1-9][0-9]*)[ \t]*$", REG_ICASE |
REG_NEWLINE | REG_EXTENDED)
     || regcomp(&Cert, "^[ \t]*Cert[ \t]+\"(.+)\"[ \t]*$", REG_ICASE |
REG_NEWLINE | REG_EXTENDED)
     || regcomp(&xHTTP, "^[ \t]*xHTTP[ \t]+([01])[ \t]*$", REG_ICASE |
REG_NEWLINE | REG_EXTENDED)
-    || regcomp(&WebDAV, "^[ \t]*WebDAV[ \t]+([01])[ \t]*$", REG_ICASE |
REG_NEWLINE | REG_EXTENDED)
+    || regcomp(&WebDAV, "^[ \t]*WebDAV[ \t]+([0123])[ \t]*$", REG_ICASE |
REG_NEWLINE | REG_EXTENDED)
     || regcomp(&Client, "^[ \t]*Client[ \t]+([1-9][0-9]*)[ \t]*$",
REG_ICASE | REG_NEWLINE | REG_EXTENDED)
     || regcomp(&CheckURL, "^[ \t]*CheckURL[ \t]+\"(.+)\"[ \t]*$",
REG_ICASE | REG_NEWLINE | REG_EXTENDED)
     || regcomp(&Err414, "^[ \t]*Err414[ \t]+\"(.+)\"[ \t]*$", REG_ICASE |
REG_NEWLINE | REG_EXTENDED)
diff -Nurd Pound-2.0.9/configure pound/configure
--- Pound-2.0.9/configure	2006-06-23 14:10:59.000000000 +0200
+++ pound/configure	2006-07-01 02:01:58.182251500 +0200
(at)(at) -853,8 +853,6 (at)(at)
                           enabled)
   --enable-super          enable or disable running with supervisor process
                           (default: enabled)
-  --enable-msdav          enable or disable the Microsoft WebDAV extensions
-                          (default: disabled)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
(at)(at) -2940,11 +2938,12 (at)(at)
   CFLAGS="${CFLAGS} -DUPER"
 fi;
 
+# Ook -- where's the real source?  No configure.{ac,in} ...
 # Check whether --enable-msdav or --disable-msdav was given.
-if test "${enable_msdav+set}" = set; then
-  enableval="$enable_msdav"
-  test ${enableval} = "yes" && CFLAGS="${CFLAGS} -DMSDAV"
-fi;
+#if test "${enable_msdav+set}" = set; then
+#  enableval="$enable_msdav"
+#  test ${enableval} = "yes" && CFLAGS="${CFLAGS} -DMSDAV"
+#fi;
 
 echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
 echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
diff -Nurd Pound-2.0.9/FAQ pound/FAQ
--- Pound-2.0.9/FAQ	2006-06-23 14:10:59.000000000 +0200
+++ pound/FAQ	2006-07-01 02:01:58.198252500 +0200
(at)(at) -384,9 +384,8 (at)(at)
 
 9.3 I try to run MS OWA and Pound rejects the requests
 
-    Make sure you configured Pound with --enable-msdav. Make sure you
-    included "WebDAV 1" in the config file. Pray that MS would adhere to
-    some known standard. Repeat as necessary.
+    Make sure you included "WebDAV 3" in the config file. Pray that MS would
+    adhere to some known standard. Repeat as necessary.
 
 9.4 How can I force OWA to accept HTTPS requests?
 
diff -Nurd Pound-2.0.9/http.c pound/http.c
--- Pound-2.0.9/http.c	2006-06-23 14:10:59.000000000 +0200
+++ pound/http.c	2006-07-01 02:12:02.524020500 +0200
(at)(at) -505,14 +505,16 (at)(at)
         strncpy(request, headers[0], MAXBUF);
         if(!regexec(&HTTP, request, 3, matches, 0)) {
             no_cont = !strncasecmp(request + matches[1].rm_so, "HEAD",
matches[1].rm_eo - matches[1].rm_so);
-        } else if(lstn->xHTTP && !regexec(&XHTTP, request, 3,
matches, 0)) {
+        } else if((lstn->xHTTP||(lstn->webDAV>1)) &&
!regexec(&XHTTP, request, 3, matches, 0)) {
             no_cont = !strncasecmp(request + matches[1].rm_so, "DELETE",
matches[1].rm_eo - matches[1].rm_so);
-        } else if(lstn->webDAV && !regexec(&WEBDAV, request, 3,
matches, 0)) {
-            /* Other WebDAV requests may also result in no content, but we
don't know - Microsoft won't tell us */
+        } else if(lstn->webDAV>=1 && !regexec(&FAKEDAV,
request, 3, matches, 0)) {
             no_cont = !(strncasecmp(request + matches[1].rm_so, "LOCK",
matches[1].rm_eo - matches[1].rm_so)
-                    && strncasecmp(request + matches[1].rm_so,
"UNLOCK", matches[1].rm_eo - matches[1].rm_so)
-                    && strncasecmp(request + matches[1].rm_so,
"DELETE", matches[1].rm_eo - matches[1].rm_so));
-                    /* && strncasecmp(request + matches[1].rm_so,
"OPTIONS", matches[1].rm_eo - matches[1].rm_so)); */
+                    || strncasecmp(request + matches[1].rm_so, "UNLOCK",
matches[1].rm_eo - matches[1].rm_so));
+        } else if(lstn->webDAV>=2 && !regexec(&WEBDAV,
request, 3, matches, 0)) {
+            /* RFC 2616: 9.2 OPTIONS says that a body will be present or
Content-Length will be 0 */
+/*          no_cont = !strncasecmp(request + matches[1].rm_so, "OPTIONS",
matches[1].rm_eo - matches[1].rm_so);*/
+        } else if(lstn->webDAV>=3 && !regexec(&MSDAV,
request, 3, matches, 0)) {
+            /* Other WebDAV requests may also result in no content, but we
don't know - Microsoft won't tell us */
         } else {
             logmsg(LOG_WARNING, "bad request \"%s\" from %s", request,
inet_ntoa(from_host));
             err_reply(cl, h501, lstn->err501);
diff -Nurd Pound-2.0.9/pound.c pound/pound.c
--- Pound-2.0.9/pound.c	2006-06-23 14:10:59.000000000 +0200
+++ pound/pound.c	2006-07-01 02:01:58.198252500 +0200
(at)(at) -46,8 +46,9 (at)(at)
 
 regex_t HTTP,               /* normal HTTP requests: GET, POST, HEAD */
         XHTTP,              /* extended HTTP requests: PUT, DELETE */
-        WEBDAV,             /* WebDAV requests: LOCK, UNLOCK, SUBSCRIBE,
PROPFIND, PROPPATCH, BPROPPATCH, SEARCH,
-                               POLL, MKCOL, MOVE, BMOVE, COPY, BCOPY, DELETE,
BDELETE, CONNECT, OPTIONS, TRACE */
+        FAKEDAV,            /* LOCK and UNLOCK requests */
+        WEBDAV,             /* part of RFC-compliant WebDAV requests */
+        MSDAV,              /* Micro$oft proprietary DAV requests */
         HEADER,             /* Allowed header */
         CHUNK_HEAD,         /* chunk header line */
         RESP_SKIP,          /* responses for which we skip response */
(at)(at) -155,11 +156,9 (at)(at)
     /* prepare regular expressions */
     if(regcomp(&HTTP, "^(GET|POST|HEAD) ([^ ]+) HTTP/1.[01]$", REG_ICASE |
REG_NEWLINE | REG_EXTENDED)
     || regcomp(&XHTTP, "^(PUT|DELETE) ([^ ]+) HTTP/1.[01]$", REG_ICASE |
REG_NEWLINE | REG_EXTENDED)
-#ifdef  MSDAV
-    || regcomp(&WEBDAV,
"^(LOCK|UNLOCK|SUBSCRIBE|PROPFIND|PROPPATCH|BPROPPATCH|SEARCH|POLL|MKCOL|MOVE|BMOVE|COPY|BCOPY|DELETE|BDELETE|CONNECT|OPTIONS|TRACE|MKACTIVITY|CHECKOUT|MERGE|REPORT)
([^ ]+) HTTP/1.[01]$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
-#else
-    || regcomp(&WEBDAV, "^(LOCK|UNLOCK) ([^ ]+) HTTP/1.[01]$", REG_ICASE |
REG_NEWLINE | REG_EXTENDED)
-#endif
+    || regcomp(&FAKEDAV, "^(LOCK|UNLOCK) ([^ ]+) HTTP/1.[01]$", REG_ICASE
| REG_NEWLINE | REG_EXTENDED)
+    || regcomp(&WEBDAV,
"^(PROPFIND|PROPPATCH|SEARCH|MKCOL|MOVE|COPY|OPTIONS|TRACE|MKACTIVITY|CHECKOUT|MERGE|REPORT)
([^ ]+) HTTP/1.[01]$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
+    || regcomp(&MSDAV,
"^(SUBSCRIBE|BPROPPATCH|POLL|BMOVE|BCOPY|BDELETE|CONNECT) ([^ ]+)
HTTP/1.[01]$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
     || regcomp(&HEADER, "^([a-z0-9!#$%&'*+.^_`|~-]+):[ \t]*(.*)[
\t]*$", REG_ICASE | REG_NEWLINE | REG_EXTENDED)
     || regcomp(&CHUNK_HEAD, "^([0-9a-f]+).*$", REG_ICASE | REG_NEWLINE |
REG_EXTENDED)
     || regcomp(&RESP_SKIP, "^HTTP/1.1 100.*$", REG_ICASE | REG_NEWLINE |
REG_EXTENDED)
diff -Nurd Pound-2.0.9/pound.h pound/pound.h
--- Pound-2.0.9/pound.h	2006-06-23 14:10:59.000000000 +0200
+++ pound/pound.h	2006-07-01 02:01:58.202252750 +0200
(at)(at) -235,8 +235,9 (at)(at)
 
 extern regex_t  HTTP,       /* normal HTTP requests: GET, POST, HEAD */
                 XHTTP,      /* extended HTTP requests: PUT, DELETE */
-                WEBDAV,     /* WebDAV requests: LOCK, UNLOCK, SUBSCRIBE,
PROPFIND, PROPPATCH, BPROPPATCH, SEARCH,
-                               POLL, MKCOL, MOVE, BMOVE, COPY, BCOPY, DELETE,
BDELETE, CONNECT, OPTIONS, TRACE */
+                FAKEDAV,    /* LOCK and UNLOCK requests */
+                WEBDAV,     /* part of RFC-compliant WebDAV requests */
+                MSDAV,      /* Micro$oft proprietary DAV requests */
                 HEADER,     /* Allowed header */
                 CHUNK_HEAD, /* chunk header line */
                 RESP_SKIP,  /* responses for which we skip response */

MailBoxer