[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-cvs
Subject:    cvs commit: httpd-2.0/modules/dav/main util.c
From:       jerenkrantz () apache ! org
Date:       2003-01-29 17:24:39
[Download RAW message or body]

jerenkrantz    2003/01/29 09:24:39

  Modified:    .        CHANGES
               modules/dav/main util.c
  Log:
  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)
  
  Revision  Changes    Path
  1.1045    +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1044
  retrieving revision 1.1045
  diff -u -u -r1.1044 -r1.1045
  --- CHANGES	29 Jan 2003 17:09:50 -0000	1.1044
  +++ CHANGES	29 Jan 2003 17:24:37 -0000	1.1045
  @@ -2,6 +2,9 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) Allow mod_dav to do weak entity comparison functions.
  +     [Justin Erenkrantz]
  +
     *) Fix If header parsing when a non-mod_dav lock token is passed to it.
        PR 16452.  [Justin Erenkrantz]
   
  
  
  
  1.45      +28 -1     httpd-2.0/modules/dav/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/dav/main/util.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -u -r1.44 -r1.45
  --- util.c	29 Jan 2003 05:07:18 -0000	1.44
  +++ util.c	29 Jan 2003 17:24:38 -0000	1.45
  @@ -1072,7 +1072,34 @@
               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) {
                       /*
  
  
  
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic