httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roy Fielding <field...@hyperreal.com>
Subject cvs commit: apache/src http_protocol.c
Date Fri, 08 Nov 1996 02:51:37 GMT
fielding    96/11/07 18:51:36

  Modified:    src       http_protocol.c
  Log:
  More tweaks to the ordering of conditional request headers.
  If If-None-Match is included and fails, then If-Modified-Since
  should not be checked.  Likewise for If-Match and If-Unmodified-Since.
  This allows the more exact check to be preferred over the less exact check.
  
  Revision  Changes    Path
  1.73      +24 -21    apache/src/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -C3 -r1.72 -r1.73
  *** http_protocol.c	1996/11/06 11:23:08	1.72
  --- http_protocol.c	1996/11/08 02:51:34	1.73
  ***************
  *** 297,341 ****
         *    respond with a status of 412 (Precondition Failed).
         */
    
  !     if (if_match &&
  !         !((if_match[0] == '*') || find_token(r->pool, if_match, etag)))
  !         return HTTP_PRECONDITION_FAILED;
  ! 
  !     /* If an If-None-Match request-header field was given and
  !      * if our ETag matches any of the entity tags in that field or
  !      * if the field value is "*" (meaning match anything), then
  !      *    if the request method was GET or HEAD, the server SHOULD
  !      *       respond with a 304 (Not Modified) response.
  !      *    For all other request methods, the server MUST
  !      *       respond with a status of 412 (Precondition Failed).
  !      */
  ! 
  !     if (if_nonematch &&
  !         ((if_nonematch[0] == '*') || find_token(r->pool, if_nonematch, etag)))
  !         return ((r->method_number == M_GET) || r->header_only) ?
  !                    HTTP_NOT_MODIFIED : HTTP_PRECONDITION_FAILED;
    
  !     /* If a valid If-Unmodified-Since request-header field was given
         * and the requested resource has been modified since the time
         * specified in this field, then the server MUST
         *    respond with a status of 412 (Precondition Failed).
         */
    
  !     if (if_unmodified) {
            time_t ius = parseHTTPdate(if_unmodified);
    
            if ((ius != BAD_DATE) && (mtime > ius))
                return HTTP_PRECONDITION_FAILED;
        }
    
  !     /* If a valid If-Modified-Since request-header field was given on a GET
         * and the requested resource has not been modified since the time
         * specified in this field, then the server MUST
         *    respond with a status of 304 (Not Modified).
         * A date later than the server's current request time is invalid.
         */
    
  !     if (if_modified_since && (r->method_number == M_GET)) {
            time_t ims = parseHTTPdate(if_modified_since);
    
            if ((ims >= mtime) && (ims <= r->request_time))
  --- 297,344 ----
         *    respond with a status of 412 (Precondition Failed).
         */
    
  !     if (if_match) {
  !         if ((if_match[0] != '*') && !find_token(r->pool, if_match, etag))
  !             return HTTP_PRECONDITION_FAILED;
  !     }
    
  !     /* Else if a valid If-Unmodified-Since request-header field was given
         * and the requested resource has been modified since the time
         * specified in this field, then the server MUST
         *    respond with a status of 412 (Precondition Failed).
         */
    
  !     else if (if_unmodified) {
            time_t ius = parseHTTPdate(if_unmodified);
    
            if ((ius != BAD_DATE) && (mtime > ius))
                return HTTP_PRECONDITION_FAILED;
        }
    
  !     /* If an If-None-Match request-header field was given and
  !      * if our ETag matches any of the entity tags in that field or
  !      * if the field value is "*" (meaning match anything), then
  !      *    if the request method was GET or HEAD, the server SHOULD
  !      *       respond with a 304 (Not Modified) response.
  !      *    For all other request methods, the server MUST
  !      *       respond with a status of 412 (Precondition Failed).
  !      */
  ! 
  !     if (if_nonematch) {
  !         if ((if_nonematch[0] == '*') || find_token(r->pool,if_nonematch,etag))
  !             return (r->method_number == M_GET) ? HTTP_NOT_MODIFIED
  !                                                : HTTP_PRECONDITION_FAILED;
  !     }
  ! 
  !     /* Else if a valid If-Modified-Since request-header field was given
  !      * and it is a GET or HEAD request
         * and the requested resource has not been modified since the time
         * specified in this field, then the server MUST
         *    respond with a status of 304 (Not Modified).
         * A date later than the server's current request time is invalid.
         */
    
  !     else if (if_modified_since && (r->method_number == M_GET)) {
            time_t ims = parseHTTPdate(if_modified_since);
    
            if ((ims >= mtime) && (ims <= r->request_time))
  
  
  

Mime
View raw message