From 6322fd9127fd39292d87eba583c02e3a7ab1c27f Mon Sep 17 00:00:00 2001 From: helge Date: Sun, 11 Jun 2006 14:31:00 +0000 Subject: [PATCH] improved WebDAV support for Cadaver git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1271 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 10 +++++ .../DynamicElements/WOxHTMLElemBuilder.m | 2 +- .../Templates/WOxComponentElemBuilder.m | 4 +- .../NGObjWeb/Templates/WOxElemBuilder.m | 2 +- sope-appserver/NGObjWeb/Version | 2 +- sope-appserver/NGObjWeb/WORequestHandler.m | 2 +- .../NGObjWeb/WebDAV/SoWebDAVRenderer.m | 20 +++++++++- sope-appserver/NGObjWeb/doc/WOCopyValue.3 | 38 ++++++++++++++++++ sope-appserver/NGObjWeb/doc/WOSetHeader.3 | 39 +++++++++++++++++++ 9 files changed, 111 insertions(+), 8 deletions(-) create mode 100644 sope-appserver/NGObjWeb/doc/WOCopyValue.3 create mode 100644 sope-appserver/NGObjWeb/doc/WOSetHeader.3 diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 438bac41..c4b4db3a 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,13 @@ +2006-06-11 Helge Hess + + * v4.5.235 + + * WebDAV/SoWebDAVRenderer.m: added a hack for Cadaver so that it + doesn't show errors on missing properties (enabled 'brief' mode), + log missing properties if debug is enabled + + * fixed some gcc 4.1 warnings + 2006-06-04 Helge Hess * WebDAV/SoWebDAVDispatcher.m: added some basic REPORT support, allows diff --git a/sope-appserver/NGObjWeb/DynamicElements/WOxHTMLElemBuilder.m b/sope-appserver/NGObjWeb/DynamicElements/WOxHTMLElemBuilder.m index 2de3dc23..a69b5bf0 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/WOxHTMLElemBuilder.m +++ b/sope-appserver/NGObjWeb/DynamicElements/WOxHTMLElemBuilder.m @@ -222,7 +222,7 @@ static Class WOGenericElementClass = Nil; children = [_element hasChildNodes] ? [_b buildNodes:[_element childNodes] templateBuilder:_b] - : nil; + : (NSArray *)nil; if ((count = [children count]) == 0) return nil; diff --git a/sope-appserver/NGObjWeb/Templates/WOxComponentElemBuilder.m b/sope-appserver/NGObjWeb/Templates/WOxComponentElemBuilder.m index 958f2172..ee0c00f3 100644 --- a/sope-appserver/NGObjWeb/Templates/WOxComponentElemBuilder.m +++ b/sope-appserver/NGObjWeb/Templates/WOxComponentElemBuilder.m @@ -115,7 +115,7 @@ static NGLogger *debugLogger = nil; children = [_element hasChildNodes] ? [_b buildNodes:[_element childNodes] templateBuilder:_b] - : nil; + : (NSArray *)nil; /* build associations */ @@ -257,7 +257,7 @@ static NGLogger *debugLogger = nil; children = [_element hasChildNodes] ? [_b buildNodes:[_element childNodes] templateBuilder:_b] - : nil; + : (NSArray *)nil; if (compName == nil) compName = [_element tagName]; diff --git a/sope-appserver/NGObjWeb/Templates/WOxElemBuilder.m b/sope-appserver/NGObjWeb/Templates/WOxElemBuilder.m index e3490e57..140683c7 100644 --- a/sope-appserver/NGObjWeb/Templates/WOxElemBuilder.m +++ b/sope-appserver/NGObjWeb/Templates/WOxElemBuilder.m @@ -772,7 +772,7 @@ static WOAssociation *yesAssoc = nil; children = [_tag hasChildNodes] ? [_b buildNodes:[_tag childNodes] templateBuilder:_b] - : nil; + : (NSArray *)nil; return [self wrapElements:children inElementOfClass:_class]; } diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 65ce298d..2c7d7416 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=234 +SUBMINOR_VERSION:=235 # v4.5.234 requires libDOM v4.5.21 # v4.5.214 requires libNGExtensions v4.5.179 diff --git a/sope-appserver/NGObjWeb/WORequestHandler.m b/sope-appserver/NGObjWeb/WORequestHandler.m index 718e51cf..c050fc0f 100644 --- a/sope-appserver/NGObjWeb/WORequestHandler.m +++ b/sope-appserver/NGObjWeb/WORequestHandler.m @@ -372,7 +372,7 @@ static NGLogger *perfLogger = nil; #endif value = [_sn isTerminating] - ? (id)@"nil" + ? (NSString *)@"nil" : [_sn sessionID]; cookie = [WOCookie cookieWithName:[app name] diff --git a/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m b/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m index b7a1ad23..f73c0e1e 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include "common.h" @@ -573,6 +574,15 @@ static BOOL formatOutput = NO; r = [_ctx response]; isBrief = [[[_ctx request] headerForKey:@"brief"] hasPrefix:@"t"] ? YES : NO; + + /* + Hack for Cadaver which shows errors when requested properties are missing. + TODO: Might not apply to all properties, find out the minimum Cadaver set. + */ + if (!isBrief) { + isBrief = [[[[_ctx request] clientCapabilities] userAgentType] + isEqualToString:@"Cadaver"]; + } if (debugOn) { [self debugWithFormat:@" render entry: 0x%08X<%@>%s%s", @@ -679,8 +689,9 @@ static BOOL formatOutput = NO; value = [key isEqualToString:@"{DAV:}href"] ? href : [entry valueForKey:okey]; - - if (![value isNotNull]) { + + /* always render resourcetype, otherwise Cadaver is confused */ + if (![value isNotNull] && ![key isEqualToString:@"{DAV:}resourcetype"]) { if (missingProps == nil) missingProps = [[NSMutableArray alloc] initWithCapacity:8]; [missingProps addObject:key]; @@ -701,6 +712,11 @@ static BOOL formatOutput = NO; /* close previous propstat and open a new one */ [r appendContentString:@""]; if (formatOutput) [r appendContentCharacter:'\n']; + + if (debugOn) { + [self debugWithFormat:@" missing: %@", + [missingProps componentsJoinedByString:@","]]; + } [r appendContentString:@""]; [r appendContentString: diff --git a/sope-appserver/NGObjWeb/doc/WOCopyValue.3 b/sope-appserver/NGObjWeb/doc/WOCopyValue.3 new file mode 100644 index 00000000..f5c82f56 --- /dev/null +++ b/sope-appserver/NGObjWeb/doc/WOCopyValue.3 @@ -0,0 +1,38 @@ +.TH WOCopyValue 3 "June 2006" "SOPE" "SOPE Dynamic Element Reference" +.\" DO NOT EDIT: this file got autogenerated using woapi2man from: +.\" ../DynamicElements/WOCopyValue.api +.\" +.\" Copyright (C) 2006 SKYRIX Software AG. All rights reserved. +.\" ==================================================================== +.\" +.\" Copyright (C) 2006 SKYRIX Software AG. All rights reserved. +.\" +.\" Check the COPYING file for further information. +.\" +.\" Created with the help of: +.\" http://www.schweikhardt.net/man_page_howto.html +.\" + +.SH NAME +WOCopyValue + +.SH SYNOPSIS +.B WOCopyValue +{ copyValues; finishValues; resetValues; } + +.SH BINDINGS +.IP copyValues +.IP finishValues +.IP resetValues +The value of 'resetValues' will be evaluated in a boolean context. + +.SH BUGS +SOPE related bugs are collected in the OpenGroupware.org Bugzilla: + http://bugzilla.opengroupware.org/ + +.SH AUTHOR +The SOPE community . + +.SH SEE ALSO +.BR sope-ngobjweb-defaults + diff --git a/sope-appserver/NGObjWeb/doc/WOSetHeader.3 b/sope-appserver/NGObjWeb/doc/WOSetHeader.3 new file mode 100644 index 00000000..f66f18db --- /dev/null +++ b/sope-appserver/NGObjWeb/doc/WOSetHeader.3 @@ -0,0 +1,39 @@ +.TH WOSetHeader 3 "June 2006" "SOPE" "SOPE Dynamic Element Reference" +.\" DO NOT EDIT: this file got autogenerated using woapi2man from: +.\" ../DynamicElements/WOSetHeader.api +.\" +.\" Copyright (C) 2006 SKYRIX Software AG. All rights reserved. +.\" ==================================================================== +.\" +.\" Copyright (C) 2006 SKYRIX Software AG. All rights reserved. +.\" +.\" Check the COPYING file for further information. +.\" +.\" Created with the help of: +.\" http://www.schweikhardt.net/man_page_howto.html +.\" + +.SH NAME +WOSetHeader + +.SH SYNOPSIS +.B WOSetHeader +{ header; value; addToExisting; object; } + +.SH BINDINGS +.IP header +.IP value +.IP addToExisting +The value of 'addToExisting' will be evaluated in a boolean context. +.IP object + +.SH BUGS +SOPE related bugs are collected in the OpenGroupware.org Bugzilla: + http://bugzilla.opengroupware.org/ + +.SH AUTHOR +The SOPE community . + +.SH SEE ALSO +.BR sope-ngobjweb-defaults + -- 2.39.5