akosut      96/08/15 12:22:41

  Modified:    src       http_protocol.c httpd.h mod_negotiation.c
  Log:
  Send 406 instead of 404 response when an acceptable variant is not
  found.
  
  Revision  Changes    Path
  1.36      +8 -1      apache/src/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -C3 -r1.35 -r1.36
  *** http_protocol.c   1996/08/07 01:27:57     1.35
  --- http_protocol.c   1996/08/15 19:22:34     1.36
  ***************
  *** 760,766 ****
        return OK;
    }
    
  ! #define RESPONSE_CODE_LIST " 200 206 301 302 304 400 401 403 404 405 411 
412 500 503 501 502 "
    
    /* New Apache routine to map error responses into array indicies 
     *  e.g.  400 -> 0,  500 -> 1,  502 -> 2 ...                     
  --- 760,766 ----
        return OK;
    }
    
  ! #define RESPONSE_CODE_LIST " 200 206 301 302 304 400 401 403 404 405 406 
411 412 500 503 501 502 "
    
    /* New Apache routine to map error responses into array indicies 
     *  e.g.  400 -> 0,  500 -> 1,  502 -> 2 ...                     
  ***************
  *** 778,783 ****
  --- 778,784 ----
       "403 Forbidden",
       "404 Not found",
       "405 Method Not Allowed",
  +    "406 Not Acceptable",
       "411 Length Required",
       "412 Precondition Failed",
       "500 Server error",
  ***************
  *** 797,802 ****
  --- 798,804 ----
       "Forbidden",
       "File Not found",
       "Method Not Allowed",
  +    "Not Acceptable",
       "Length Required",
       "Precondition Failed",
       "Server Error",
  ***************
  *** 1328,1333 ****
  --- 1330,1340 ----
            bvputs(fd, "The requested method ", r->method, " is not allowed "
                   "for the URL ", escape_html(r->pool, r->uri),
                   ".<P>\n", NULL);
  +         break;
  +     case NOT_ACCEPTABLE:
  +         bvputs(fd, "An appropriate variant to the requested entity ",
  +                escape_html(r->pool, r->uri), " could not be found "
  +                "on this server.<P>\n", NULL);
            break;
        case LENGTH_REQUIRED:
            bvputs(fd, "A request of the requested method ", r->method,
  
  
  
  1.45      +2 -1      apache/src/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/httpd.h,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -C3 -r1.44 -r1.45
  *** httpd.h   1996/08/07 01:27:58     1.44
  --- httpd.h   1996/08/15 19:22:37     1.45
  ***************
  *** 263,275 ****
    #define FORBIDDEN 403
    #define NOT_FOUND 404
    #define METHOD_NOT_ALLOWED 405
    #define LENGTH_REQUIRED 411
    #define PRECONDITION_FAILED 412
    #define SERVER_ERROR 500
    #define NOT_IMPLEMENTED 501
    #define BAD_GATEWAY 502
    #define HTTP_SERVICE_UNAVAILABLE 503
  ! #define RESPONSE_CODES 15
    
    #define METHODS 8
    #define M_GET 0
  --- 263,276 ----
    #define FORBIDDEN 403
    #define NOT_FOUND 404
    #define METHOD_NOT_ALLOWED 405
  + #define NOT_ACCEPTABLE 406
    #define LENGTH_REQUIRED 411
    #define PRECONDITION_FAILED 412
    #define SERVER_ERROR 500
    #define NOT_IMPLEMENTED 501
    #define BAD_GATEWAY 502
    #define HTTP_SERVICE_UNAVAILABLE 503
  ! #define RESPONSE_CODES 16
    
    #define METHODS 8
    #define M_GET 0
  
  
  
  1.13      +2 -10     apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -C3 -r1.12 -r1.13
  *** mod_negotiation.c 1996/08/15 18:36:42     1.12
  --- mod_negotiation.c 1996/08/15 19:22:38     1.13
  ***************
  *** 127,138 ****
    { NULL }
    };
    
  - /*
  -  * TO DO --- error code 406.  Unfortunately, the specification for
  -  *           a 406 reply in the current draft standard is unworkable;
  -  *           we return 404 for these pending a workable spec. 
  -  */
  - 
    /* Record of available info on a media type specified by the client
     * (we also use 'em for encodings and languages)
     */
  --- 127,132 ----
  ***************
  *** 1079,1087 ****
        maybe_add_default_encodings(neg, 0);
        
        if (!(best = best_match(neg))) {
  -       /* Should be a 406 */
          log_reason ("no acceptable variant", r->filename, r);
  !       return NOT_FOUND;
        }
    
        /* Make sure caching works - Vary should handle HTTP/1.1, but for
  --- 1073,1080 ----
        maybe_add_default_encodings(neg, 0);
        
        if (!(best = best_match(neg))) {
          log_reason ("no acceptable variant", r->filename, r);
  !       return NOT_ACCEPTABLE;
        }
    
        /* Make sure caching works - Vary should handle HTTP/1.1, but for
  ***************
  *** 1121,1129 ****
        if (neg->avail_vars->nelts == 0) return DECLINED;
        
        if (!(best = best_match(neg))) {
  -       /* Should be a 406 */
          log_reason ("no acceptable variant", r->filename, r);
  !       return NOT_FOUND;
        }
    
        if (! (sub_req = best->sub_req)) {
  --- 1114,1121 ----
        if (neg->avail_vars->nelts == 0) return DECLINED;
        
        if (!(best = best_match(neg))) {
          log_reason ("no acceptable variant", r->filename, r);
  !       return NOT_ACCEPTABLE;
        }
    
        if (! (sub_req = best->sub_req)) {
  
  
  

Reply via email to