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 httpd.h http_protocol.c http_request.c mod_asis.c
Date Wed, 16 Oct 1996 23:24:38 GMT
fielding    96/10/16 16:24:37

  Modified:    src       httpd.h http_protocol.c http_request.c mod_asis.c
  Log:
  Reduced dependency on magic number status codes in server core
  and removed artificial restrictions on range of codes used by server,
  particularly in mod_asis where flexibility is paramount.
  Many other modules continue to use magic numbers, but those can wait.
  
  Revision  Changes    Path
  1.55      +9 -1      apache/src/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/httpd.h,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -C3 -r1.54 -r1.55
  *** httpd.h	1996/10/13 13:35:29	1.54
  --- httpd.h	1996/10/16 23:24:32	1.55
  ***************
  *** 50,56 ****
     *
     */
    
  ! /* $Id: httpd.h,v 1.54 1996/10/13 13:35:29 ben Exp $ */
    
    /*
     * httpd.h: header for simple (ha! not anymore) http daemon
  --- 50,56 ----
     *
     */
    
  ! /* $Id: httpd.h,v 1.55 1996/10/16 23:24:32 fielding Exp $ */
    
    /*
     * httpd.h: header for simple (ha! not anymore) http daemon
  ***************
  *** 312,317 ****
  --- 312,325 ----
    #define NOT_IMPLEMENTED     HTTP_NOT_IMPLEMENTED
    #define BAD_GATEWAY         HTTP_BAD_GATEWAY
    #define VARIANT_ALSO_VARIES HTTP_VARIANT_ALSO_VARIES
  + 
  + #define is_HTTP_INFO(x)         ((x >= 100)&&(x < 200))
  + #define is_HTTP_SUCCESS(x)      ((x >= 200)&&(x < 300))
  + #define is_HTTP_REDIRECT(x)     ((x >= 300)&&(x < 400))
  + #define is_HTTP_ERROR(x)        ((x >= 400)&&(x < 600))
  + #define is_HTTP_CLIENT_ERROR(x) ((x >= 400)&&(x < 500))
  + #define is_HTTP_SERVER_ERROR(x) ((x >= 500)&&(x < 600))
  + 
    
    #define METHODS 8
    #define M_GET 0
  
  
  
  1.57      +24 -18    apache/src/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -C3 -r1.56 -r1.57
  *** http_protocol.c	1996/10/16 20:56:19	1.56
  --- http_protocol.c	1996/10/16 23:24:33	1.57
  ***************
  *** 50,56 ****
     *
     */
      
  ! /* $Id: http_protocol.c,v 1.56 1996/10/16 20:56:19 fielding Exp $ */
    
    /*
     * http_protocol.c --- routines which directly communicate with the
  --- 50,56 ----
     *
     */
      
  ! /* $Id: http_protocol.c,v 1.57 1996/10/16 23:24:33 fielding Exp $ */
    
    /*
     * http_protocol.c --- routines which directly communicate with the
  ***************
  *** 363,369 ****
         * to succeed if the GET was successful; ErrorDocuments *always* get sent.
         */
        
  !     if ((r->status < 200) || (r->status >= 300))
            return OK;
    
        if (if_modified_since && !r->header_only &&
  --- 363,369 ----
         * to succeed if the GET was successful; ErrorDocuments *always* get sent.
         */
        
  !     if (!is_HTTP_SUCCESS(r->status))
            return OK;
    
        if (if_modified_since && !r->header_only &&
  ***************
  *** 650,656 ****
    
        r->sent_bodyct = 0; /* bytect isn't for body */
        
  !     r->status = 200;		/* Until further notice.
    				 * Only changed by die(), or (bletch!)
    				 * scan_script_header...
    				 */
  --- 650,656 ----
    
        r->sent_bodyct = 0; /* bytect isn't for body */
        
  !     r->status = HTTP_OK;	/* Until further notice.
    				 * Only changed by die(), or (bletch!)
    				 * scan_script_header...
    				 */
  ***************
  *** 711,717 ****
        rnew->method = "GET"; rnew->method_number = M_GET;
        rnew->protocol = "INCLUDED";
    
  !     rnew->status = 200;
    
        rnew->headers_in = r->headers_in;
        rnew->subprocess_env = copy_table (rnew->pool, r->subprocess_env);
  --- 711,717 ----
        rnew->method = "GET"; rnew->method_number = M_GET;
        rnew->protocol = "INCLUDED";
    
  !     rnew->status = HTTP_OK;
    
        rnew->headers_in = r->headers_in;
        rnew->subprocess_env = copy_table (rnew->pool, r->subprocess_env);
  ***************
  *** 1117,1136 ****
        return OK;
    }
    
  ! int should_client_block (request_rec *r) {
  !    if (r->method_number != M_POST && r->method_number != M_PUT)
  !        return 0;
    
  !    if (r->proto_num >= 1001) {
  !        bvputs(r->connection->client,
  !             SERVER_PROTOCOL, " 100 Continue\015\012\015\012", NULL);
  !        bflush(r->connection->client);
  !    }
    
  !    return 1;
    }
    
  ! static int rd_chunk_size (BUFF *b) {
        int chunksize = 0;
        int c;
    
  --- 1117,1142 ----
        return OK;
    }
    
  ! int should_client_block (request_rec *r)
  ! {
  !     /* The following should involve a test of whether the request message
  !      * included a Content-Length or Transfer-Encoding header field, since
  !      * methods are supposed to be extensible.  However, this'll do for now.
  !      */
  !     if (r->method_number != M_POST && r->method_number != M_PUT)
  !         return 0;
    
  !     if (r->proto_num >= 1001) {    /* sending 100 Continue interim response */
  !         bvputs(r->connection->client,
  !             SERVER_PROTOCOL, " ", status_lines[0], "\015\012\015\012", NULL);
  !         bflush(r->connection->client);
  !     }
    
  !     return 1;
    }
    
  ! static int rd_chunk_size (BUFF *b)
  ! {
        int chunksize = 0;
        int c;
    
  ***************
  *** 1302,1309 ****
    
        /* If status code not found, use code 500.  */
        if (idx == -1) {
  !         status = SERVER_ERROR;
  !         idx = index_of_response (SERVER_ERROR);
        }
    
        if (!r->assbackwards) {
  --- 1308,1315 ----
    
        /* If status code not found, use code 500.  */
        if (idx == -1) {
  !         status = HTTP_INTERNAL_SERVER_ERROR;
  !         idx = index_of_response(HTTP_INTERNAL_SERVER_ERROR);
        }
    
        if (!r->assbackwards) {
  ***************
  *** 1336,1342 ****
    	 */
    	bputs("Connection: close\015\012", c->client);
    	
  ! 	if (location && (status >= 300) && (status < 400))
    	    bvputs(c->client, "Location: ", location, "\015\012", NULL);
    
    	if ((status == METHOD_NOT_ALLOWED) || (status == NOT_IMPLEMENTED))
  --- 1342,1348 ----
    	 */
    	bputs("Connection: close\015\012", c->client);
    	
  ! 	if (location && is_HTTP_REDIRECT(status))
    	    bvputs(c->client, "Location: ", location, "\015\012", NULL);
    
    	if ((status == METHOD_NOT_ALLOWED) || (status == NOT_IMPLEMENTED))
  ***************
  *** 1372,1378 ****
    	}
    	/* Redirect failed, so get back the original error
    	 */
  ! 	while (r->prev && r->prev->status != 200)
              r = r->prev;
        }
        {
  --- 1378,1384 ----
    	}
    	/* Redirect failed, so get back the original error
    	 */
  ! 	while (r->prev && (r->prev->status != HTTP_OK))
              r = r->prev;
        }
        {
  
  
  
  1.18      +5 -5      apache/src/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_request.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -C3 -r1.17 -r1.18
  *** http_request.c	1996/10/16 17:29:22	1.17
  --- http_request.c	1996/10/16 23:24:34	1.18
  ***************
  *** 50,56 ****
     *
     */
    
  ! /* $Id: http_request.c,v 1.17 1996/10/16 17:29:22 ben Exp $ */
    
    /*
     * http_request.c: functions to get and process requests
  --- 50,56 ----
     *
     */
    
  ! /* $Id: http_request.c,v 1.18 1996/10/16 23:24:34 fielding Exp $ */
    
    /*
     * http_request.c: functions to get and process requests
  ***************
  *** 540,549 ****
        if (rnew->finfo.st_mode == 0 && stat (rnew->filename, &rnew->finfo)
< 0)
            rnew->finfo.st_mode = 0;
    
  !     if ((rnew->status == 200) && (res = find_types (rnew)))
            rnew->status = res;
        
  !     if ((rnew->status == 200) && (res = run_fixups (rnew)))
            rnew->status = res;
        
        return rnew;
  --- 540,549 ----
        if (rnew->finfo.st_mode == 0 && stat (rnew->filename, &rnew->finfo)
< 0)
            rnew->finfo.st_mode = 0;
    
  !     if ((rnew->status == HTTP_OK) && (res = find_types (rnew)))
            rnew->status = res;
        
  !     if ((rnew->status == HTTP_OK) && (res = run_fixups (rnew)))
            rnew->status = res;
        
        return rnew;
  ***************
  *** 687,696 ****
         * any attempt to handle the other thing "intelligently"...
         */
    
  !     if (r->status != 200) {
            recursive_error = type;
    
  ! 	while (r->prev && r->prev->status != 200)
    	  r = r->prev; /* Get back to original error */
    	
    	type = r->status;
  --- 687,696 ----
         * any attempt to handle the other thing "intelligently"...
         */
    
  !     if (r->status != HTTP_OK) {
            recursive_error = type;
    
  ! 	while (r->prev && (r->prev->status != HTTP_OK))
    	  r = r->prev; /* Get back to original error */
    	
    	type = r->status;
  
  
  
  1.7       +4 -3      apache/src/mod_asis.c
  
  Index: mod_asis.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_asis.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -C3 -r1.6 -r1.7
  *** mod_asis.c	1996/08/20 11:50:56	1.6
  --- mod_asis.c	1996/10/16 23:24:34	1.7
  ***************
  *** 50,56 ****
     *
     */
    
  ! /* $Id: mod_asis.c,v 1.6 1996/08/20 11:50:56 paul Exp $ */
    
    #include "httpd.h"
    #include "http_config.h"
  --- 50,56 ----
     *
     */
    
  ! /* $Id: mod_asis.c,v 1.7 1996/10/16 23:24:34 fielding Exp $ */
    
    #include "httpd.h"
    #include "http_config.h"
  ***************
  *** 82,90 ****
        location = table_get (r->headers_out, "Location");
    
        if (location && location[0] == '/' && 
  !         (r->status == 200 || r->status == 301 || r->status == 302)) {
    
  !         r->status = 200; /* Assume 200 status on whatever we're pointing to */
    
    	/* This redirect needs to be a GET no matter what the original
    	 * method was.
  --- 82,91 ----
        location = table_get (r->headers_out, "Location");
    
        if (location && location[0] == '/' && 
  !         ((r->status == HTTP_OK) || is_HTTP_REDIRECT(r->status))) {
    
  !         /* Internal redirect -- fake-up a pseudo-request */
  !         r->status = HTTP_OK;
    
    	/* This redirect needs to be a GET no matter what the original
    	 * method was.
  
  
  

Mime
View raw message