summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorJustin Erenkrantz <jerenkrantz@apache.org>2003-01-29 18:24:38 +0100
committerJustin Erenkrantz <jerenkrantz@apache.org>2003-01-29 18:24:38 +0100
commit9c18a024fe5641c96babac03ad8aa2c1a0edcbbc (patch)
tree25a0d8488b567ea4ca6127f16f30cecd7055fc2e /modules
parentEnabled the -n parameter on NetWare to allow the administrator to rename (diff)
downloadapache2-9c18a024fe5641c96babac03ad8aa2c1a0edcbbc.tar.xz
apache2-9c18a024fe5641c96babac03ad8aa2c1a0edcbbc.zip
Allow mod_dav to do weak entity comparison function rather than a strong
entity comparison function. (i.e. it will optionally strip the W/ prefix.) PR: 14921 (kinda, but not really) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98536 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r--modules/dav/main/util.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/modules/dav/main/util.c b/modules/dav/main/util.c
index 8cbc76a970..ea44b10783 100644
--- a/modules/dav/main/util.c
+++ b/modules/dav/main/util.c
@@ -1072,7 +1072,34 @@ static dav_error * dav_validate_resource_state(apr_pool_t *p,
switch(state_list->type) {
case dav_if_etag:
{
- int mismatch = strcmp(state_list->etag, etag);
+ const char *given_etag, *current_etag;
+ int mismatch;
+
+ /* Do a weak entity comparison function as defined in
+ * RFC 2616 13.3.3.
+ */
+ if (state_list->etag[0] == '"' &&
+ state_list->etag[1] == 'W' &&
+ state_list->etag[2] == '/') {
+ given_etag = apr_pstrdup(p, state_list->etag);
+ given_etag += 2;
+ given_etag[0] = '"';
+ }
+ else {
+ given_etag = state_list->etag;
+ }
+ if (etag[0] == '"' &&
+ etag[1] == 'W' &&
+ etag[2] == '/') {
+ current_etag = apr_pstrdup(p, etag);
+ current_etag += 2;
+ current_etag[0] = '"';
+ }
+ else {
+ current_etag = etag;
+ }
+
+ mismatch = strcmp(given_etag, current_etag);
if (state_list->condition == DAV_IF_COND_NORMAL && mismatch) {
/*