summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-05-08 02:50:56 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2019-05-08 02:56:37 -0400
commite9abd76acc6f924b9a8d808e1e4123572b29fec0 (patch)
treedf42f14877b7d9e359ea1834704af862be68ea63
parent9bb01a49dfca28f4781d911424e7c07c61d5131d (diff)
downloadlighttpd1.4-e9abd76acc6f924b9a8d808e1e4123572b29fec0.tar.gz
lighttpd1.4-e9abd76acc6f924b9a8d808e1e4123572b29fec0.zip
[mod_webdav] workaround Microsoft-WebDAV-MiniRedir
workaround Microsoft-WebDAV-MiniRedir bugs
-rw-r--r--src/mod_webdav.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mod_webdav.c b/src/mod_webdav.c
index 68d20435..592df188 100644
--- a/src/mod_webdav.c
+++ b/src/mod_webdav.c
@@ -3742,6 +3742,14 @@ mod_webdav_propfind (connection * const con, const plugin_config * const pconf)
}
else if (S_ISDIR(pb.st.st_mode)) {
if (con->physical.path->ptr[con->physical.path->used - 2] != '/') {
+ buffer *vb = http_header_request_get(con, HTTP_HEADER_OTHER,
+ CONST_STR_LEN("User-Agent"));
+ if (vb && 0 == strncmp(vb->ptr, "Microsoft-WebDAV-MiniRedir/",
+ sizeof("Microsoft-WebDAV-MiniRedir/")-1)) {
+ /* workaround Microsoft-WebDAV-MiniRedir bug */
+ http_response_redirect_to_directory(pconf->srv, con, 308);
+ return HANDLER_FINISHED;
+ }
/* set "Content-Location" instead of sending 308 redirect to dir */
if (!http_response_redirect_to_directory(pconf->srv, con, 0))
return HANDLER_FINISHED;
@@ -4914,6 +4922,16 @@ mod_webdav_proppatch (connection * const con, const plugin_config * const pconf)
if (S_ISDIR(st.st_mode)) {
if (con->physical.path->ptr[con->physical.path->used - 2] != '/') {
+ buffer *vb = http_header_request_get(con, HTTP_HEADER_OTHER,
+ CONST_STR_LEN("User-Agent"));
+ if (vb && 0 == strncmp(vb->ptr, "Microsoft-WebDAV-MiniRedir/",
+ sizeof("Microsoft-WebDAV-MiniRedir/")-1)) {
+ /* workaround Microsoft-WebDAV-MiniRedir bug */
+ /* (might not be necessary for PROPPATCH here,
+ * but match behavior in mod_webdav_propfind() for PROPFIND) */
+ http_response_redirect_to_directory(pconf->srv, con, 308);
+ return HANDLER_FINISHED;
+ }
/* set "Content-Location" instead of sending 308 redirect to dir */
if (!http_response_redirect_to_directory(pconf->srv, con, 0))
return HANDLER_FINISHED;
@@ -5023,6 +5041,16 @@ mod_webdav_proppatch (connection * const con, const plugin_config * const pconf)
if (NULL == ms
? webdav_db_transaction_commit(pconf)
: webdav_db_transaction_rollback(pconf)) {
+ if (NULL == ms) {
+ buffer *vb = http_header_request_get(con, HTTP_HEADER_OTHER,
+ CONST_STR_LEN("User-Agent"));
+ if (vb && 0 == strncmp(vb->ptr, "Microsoft-WebDAV-MiniRedir/",
+ sizeof("Microsoft-WebDAV-MiniRedir/")-1)) {
+ /* workaround Microsoft-WebDAV-MiniRedir bug; 204 not handled */
+ ms = buffer_init(); /* 207 Multi-status */
+ webdav_xml_response_status(ms, con->physical.path, 200);
+ }
+ }
if (NULL == ms)
http_status_set_fin(con, 204); /* No Content */
else /* 207 Multi-status */