You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2005/10/30 14:25:34 UTC
svn commit: r329562 - in /httpd/httpd/trunk/modules/dav/main: mod_dav.h
util.c
Author: jorton
Date: Sun Oct 30 05:25:28 2005
New Revision: 329562
URL: http://svn.apache.org/viewcvs?rev=329562&view=rev
Log:
Fix handling of unknown state tokens in If headers:
* modules/dav/main/mod_dav.h: Add dav_if_unknown to dav_if_state_type
enum.
* modules/dav/main/util.c (dav_add_if_state): Set returned type to
dav_if_unknown for an unknown state token.
(dav_validate_resource_state): Evaluate dav_if_unknown to fail
match unless in a Not condition.
PR: 37288
Modified:
httpd/httpd/trunk/modules/dav/main/mod_dav.h
httpd/httpd/trunk/modules/dav/main/util.c
Modified: httpd/httpd/trunk/modules/dav/main/mod_dav.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/dav/main/mod_dav.h?rev=329562&r1=329561&r2=329562&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/main/mod_dav.h (original)
+++ httpd/httpd/trunk/modules/dav/main/mod_dav.h Sun Oct 30 05:25:28 2005
@@ -686,7 +686,8 @@
typedef enum
{
dav_if_etag,
- dav_if_opaquelock
+ dav_if_opaquelock,
+ dav_if_unknown /* the "unknown" state type; always matches false. */
} dav_if_state_type;
typedef struct dav_if_state_list
Modified: httpd/httpd/trunk/modules/dav/main/util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/dav/main/util.c?rev=329562&r1=329561&r2=329562&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/main/util.c (original)
+++ httpd/httpd/trunk/modules/dav/main/util.c Sun Oct 30 05:25:28 2005
@@ -539,11 +539,11 @@
if ((err = (*locks_hooks->parse_locktoken)(p, state_token,
&new_sl->locktoken)) != NULL) {
- /* In cases where the state token is invalid, we'll just skip
- * it rather than return 400.
- */
+ /* If the state token cannot be parsed, treat it as an
+ * unknown state; this will evaluate to "false" later
+ * during If header validation. */
if (err->error_id == DAV_ERR_LOCK_UNK_STATE_TOKEN) {
- return NULL;
+ new_sl->type = dav_if_unknown;
}
else {
/* ### maybe add a higher-level description */
@@ -1198,6 +1198,18 @@
goto state_list_failed;
}
+ break;
+
+ case dav_if_unknown:
+ /* Request is predicated on some unknown state token,
+ * which must be presumed to *not* match, so fail
+ * unless this is a Not condition. */
+
+ if (state_list->condition == DAV_IF_COND_NORMAL) {
+ reason =
+ "an unknown state token was supplied";
+ goto state_list_failed;
+ }
break;
} /* switch */