Index: openacs-4/packages/xotcl-core/tcl/50-protocol-handler-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/50-protocol-handler-procs.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/xotcl-core/tcl/50-protocol-handler-procs.tcl 29 Jul 2013 08:44:14 -0000 1.8 +++ openacs-4/packages/xotcl-core/tcl/50-protocol-handler-procs.tcl 14 Feb 2014 18:20:44 -0000 1.8.2.1 @@ -97,7 +97,7 @@ ns_returnunauthorized return filter_return } - + # set common data for all kind of requests my initialize @@ -121,7 +121,7 @@ To change that, it would be necessary to register the filter before the request processor (currently, there - are no hooks for that). + are no hooks for that). } { set filter_url [my url]* set url [my url]/* @@ -178,15 +178,15 @@ DELETE LOCK UNLOCK OPTIONS REPORT } { - ns_register_filter preauth $method $filter_url [self] - ns_register_filter preauth $method $root [self] - ns_register_proc $method $url [self] handle_request - ns_register_proc $method $root [self] handle_request + ns_register_filter preauth $method $filter_url [self] + ns_register_filter preauth $method $root [self] + ns_register_proc $method $url [self] handle_request + ns_register_proc $method $root [self] handle_request - - #my log "--ns_register_filter preauth $method $filter_url [self]" - #my log "--ns_register_proc $method $url [self] handle_request" - } + + #my log "--ns_register_filter preauth $method $filter_url [self]" + #my log "--ns_register_proc $method $url [self] handle_request" + } ns_register_proc OPTIONS / ::xo::minimalProctocolHandler OPTIONS ns_register_proc PROPFIND / ::xo::minimalProctocolHandler PROPFIND } @@ -207,9 +207,9 @@ dispatches the HTTP requests. } { my instvar uri method user_id - + #my log "--handle_request method=$method uri=$uri\ - # userid=$user_id -ns_conn query '[ns_conn query]'" + # userid=$user_id -ns_conn query '[ns_conn query]'" if {[my exists package]} { my set package_id [my get_package_id] } @@ -243,7 +243,7 @@ ProtocolHandler instproc multiStatus {body} { append _ {} \n \ - {} $body \n \n + {} $body \n \n } ProtocolHandler instproc multiStatusResonse { @@ -253,46 +253,46 @@ } { #my log "multiStatusResonse href $href propstats $propstats" append reply \n \ - {} \ - "\n$href\n" + {} \ + "\n$href\n" # The multi-status respons has 2 formats # - with (used in PROPFIND and PROPPATCH) # - without (used in other cases, e.g. DELETE, COPY, MOVE for collections) # http://www.webdav.org/specs/rfc4918.html#multi-status.response # foreach {props status} $propstats { if {$propstatus} { - append reply \n - if {[llength $props] > 0} { - append reply \n - foreach {name value} $props { - if {$value ne ""} { - append reply <$name>$value\n - } else { - append reply <$name/>\n - } - } - append reply \n - } else { - append reply \n - } - append reply $status\n\n + append reply \n + if {[llength $props] > 0} { + append reply \n + foreach {name value} $props { + if {$value ne ""} { + append reply <$name>$value\n + } else { + append reply <$name/>\n + } + } + append reply \n + } else { + append reply \n + } + append reply $status\n\n } else { - append reply $status\n + append reply $status\n } } append reply \n } ProtocolHandler instproc multiStatusError {status} { lappend davprops \ - D:getlastmodified "" \ - D:getcontentlength "" \ - D:creationdate "" \ - D:resourcetype "" + D:getlastmodified "" \ + D:getcontentlength "" \ + D:creationdate "" \ + D:resourcetype "" set r [my multiStatus [my multiStatusResonse \ - -href [ns_urldecode [ns_conn url]] \ - -propstats [list $davprops $status]]] + -href [ns_urldecode [ns_conn url]] \ + -propstats [list $davprops $status]]] my log multiStatusError=$r ns_return 207 text/xml $r } @@ -313,21 +313,21 @@ ns_set put [ns_conn outputheaders] Allow OPTIONS ns_return 200 text/plain {} } - + ProtocolHandler instproc PROPFIND {} { #my log "--ProtocolHandler PROPFIND [ns_conn content]" # when GET is not supported on this resource, the get* properties are not be sent # see http://www.webdav.org/specs/rfc4918.html, 9.1.5 lappend davprops \ - lp1:resourcetype \ - lp1:creationdate [my tcl_time_to_iso8601 "2013-06-30 01:21:22.648325+02"] \ - D:supportedlock {} \ - D:lockdiscovery {} - - ns_return 207 text/xml [my multiStatus \ - [my multiStatusResonse \ - -href [my set uri] \ - -propstats [list $davprops "HTTP/1.1 200 OK"]]] + lp1:resourcetype \ + lp1:creationdate [my tcl_time_to_iso8601 "2013-06-30 01:21:22.648325+02"] \ + D:supportedlock {} \ + D:lockdiscovery {} + + ns_return 207 text/xml [my multiStatus \ + [my multiStatusResonse \ + -href [my set uri] \ + -propstats [list $davprops "HTTP/1.1 200 OK"]]] } ::xo::ProtocolHandler create ::xo::minimalProctocolHandler @@ -338,4 +338,12 @@ ::xo::minimalProctocolHandler proc PROPFIND {args} { my multiStatusError "HTTP/1.1 403 Forbidden" } -} \ No newline at end of file +} + + +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: