Roxen.git
/
server
/
base_server
/
module.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/base_server/module.pike:1316:
{ SIMPLE_TRACE_ENTER(this, "Checking \"If\" header for %O", relative_path); int/*LockFlag*/|DAVLock lock = check_locks(relative_path, recursive, id); int(0..1) got_sublocks; if (lock && intp(lock)) { if (lock & 1) { TRACE_LEAVE("Locked by other user.");
-
return Roxen.http_
status
(Protocols.HTTP.DAV_LOCKED);
+
return Roxen.http_
dav_error
(Protocols.HTTP.DAV_LOCKED
,
+
"lock-token-submitted"
);
} else if (recursive) // This is set for LOCK_OWN_BELOW too since it might be // necessary to come back here and check the If header for // those locks. got_sublocks = 1; } string path = relative_path; if (!has_suffix (path, "/")) path += "/"; // get_if_data always adds a "/". path = query_location() + path; // No need for fancy combine_path stuff here. mapping(string:array(array(array(string)))) if_data = id->get_if_data(); array(array(array(string))) condition; if (!if_data || !sizeof(condition = if_data[path] || if_data[0])) { if (lock) { TRACE_LEAVE("Locked, no if header.");
-
return Roxen.http_
status
(Protocols.HTTP.DAV_LOCKED);
+
return Roxen.http_
dav_error
(Protocols.HTTP.DAV_LOCKED
,
+
"lock-token-submitted"
);
} SIMPLE_TRACE_LEAVE("No lock and no if header - ok%s.", got_sublocks ? " (this level only)" : ""); return got_sublocks; // No condition and no lock -- Ok. } string|int(-1..0) etag; int(0..1) locked_fail = !!lock; next_condition:
Roxen.git/server/base_server/module.pike:1409:
got_sublocks ? " (this level only)" : ""); return got_sublocks; // Found matching sub-condition. } SIMPLE_TRACE_LEAVE("Conditional ok, but still locked (locktoken: %O).", lock->locktoken); locked_fail = 1; } if (locked_fail) { TRACE_LEAVE("Failed (locked).");
-
}
else
{
+
return Roxen.http_dav_error(Protocols.HTTP.DAV_LOCKED,
+
"lock-token-submitted");
+
}
+
TRACE_LEAVE("Precondition failed.");
-
+
return Roxen.http_status(Protocols.HTTP.HTTP_PRECOND_FAILED);
}
-
return Roxen.http_status(locked_fail ?
-
Protocols.HTTP.DAV_LOCKED :
-
Protocols.HTTP.HTTP_PRECOND_FAILED);
-
}
+
//! Used by some default implementations to check if we may perform a //! write access to @[path]. It should at least call //! @[check_if_header] to check DAV locks. It takes the same arguments //! and has the same return value as that function. //! //! WARNING: This function has some design issues and will very likely //! get a different interface. Compatibility is NOT guaranteed. //! //! A filesystem module should typically put all needed write access