httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Behlendorf <br...@hyperreal.com>
Subject cvs commit: apache/src http_config.h http_protocol.c http_protocol.h mod_cgi.c
Date Tue, 08 Oct 1996 21:47:06 GMT
brian       96/10/08 14:47:05

  Modified:    src       http_config.h http_protocol.c http_protocol.h
                        mod_cgi.c
  Log:
  Reviewed by:	Brian Behlendorf
  Submitted by:	Alexei Kosut
  
  Patch to properly support "100 Continue" for HTTP/1.1, and bring mod_cgi.c in line.
  
  Revision  Changes    Path
  1.13      +2 -2      apache/src/http_config.h
  
  Index: http_config.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_config.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -C3 -r1.12 -r1.13
  *** http_config.h	1996/10/06 02:25:02	1.12
  --- http_config.h	1996/10/08 21:46:57	1.13
  ***************
  *** 50,56 ****
     *
     */
    
  ! /* $Id: http_config.h,v 1.12 1996/10/06 02:25:02 fielding Exp $ */
    
    /*
     * The central data structures around here...
  --- 50,56 ----
     *
     */
    
  ! /* $Id: http_config.h,v 1.13 1996/10/08 21:46:57 brian Exp $ */
    
    /*
     * The central data structures around here...
  ***************
  *** 215,221 ****
     * handle it back-compatibly, or at least signal an error).
     */
    
  ! #define MODULE_MAGIC_NUMBER 19960806
    #define STANDARD_MODULE_STUFF MODULE_MAGIC_NUMBER, 0, __FILE__, NULL
    
    /* Generic accessors for other modules to get at their own module-specific
  --- 215,221 ----
     * handle it back-compatibly, or at least signal an error).
     */
    
  ! #define MODULE_MAGIC_NUMBER 19961007
    #define STANDARD_MODULE_STUFF MODULE_MAGIC_NUMBER, 0, __FILE__, NULL
    
    /* Generic accessors for other modules to get at their own module-specific
  
  
  
  1.53      +41 -3     apache/src/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -C3 -r1.52 -r1.53
  *** http_protocol.c	1996/10/08 20:43:33	1.52
  --- http_protocol.c	1996/10/08 21:46:59	1.53
  ***************
  *** 50,56 ****
     *
     */
      
  ! /* $Id: http_protocol.c,v 1.52 1996/10/08 20:43:33 brian Exp $ */
    
    /*
     * http_protocol.c --- routines which directly communicate with the
  --- 50,56 ----
     *
     */
      
  ! /* $Id: http_protocol.c,v 1.53 1996/10/08 21:46:59 brian Exp $ */
    
    /*
     * http_protocol.c --- routines which directly communicate with the
  ***************
  *** 1051,1056 ****
  --- 1051,1085 ----
    
    }
    
  + /* Here we deal with getting input from the client. This can be in the
  +  * form of POST or PUT (other methods can be added later), and may be
  +  * transmitted in either a fixed content-length or via chunked
  +  * transfer-coding.
  +  *
  +  * Note that this is more complicated than it was in Apache 1.1 and prior
  +  * versions, because chunked support means that the module does less.
  +  *
  +  * The proper procedure is this:
  +  * 1. Call setup_client_block() near the beginning of the request
  +  *    handler. This will set up all the neccessary properties, and
  +  *    will return either OK, or an error code. If the latter,
  +  *    the module should return that error code.
  +  *
  +  * 2. When you are ready to possibly accept input, call should_client_block().
  +  *    This will tell the module whether or not to read input. If it is 0,
  +  *    the module should assume that the input is of a non-entity type
  +  *    (e.g. a GET request). This step also sends a 100 Continue response
  +  *    to HTTP/1.1 clients, so should not be called until the module
  +  *    is *defenitely* ready to read content. (otherwise, the point of the
  +  *    100 response is defeated). Never call this function more than once.
  +  *
  +  * 3. Finally, call get_client_block in a loop. Pass it a buffer and its
  +  *    size. It will put data into the buffer (not neccessarily the full
  +  *    buffer, in the case of chunked inputs), and return the length of
  +  *    the input block. When it is done reading, it will return 0.
  +  *
  +  */
  + 
    int setup_client_block (request_rec *r)
    {
        char *tenc = table_get (r->headers_in, "Transfer-Encoding");
  ***************
  *** 1078,1084 ****
    }
    
    int should_client_block (request_rec *r) {
  !     return (r->method_number == M_POST || r->method_number == M_PUT);
    }
    
    static int rd_chunk_size (BUFF *b) {
  --- 1107,1122 ----
    }
    
    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) {
  ***************
  *** 1103,1109 ****
        return (c == EOF) ? -1 : chunksize;
    }
    
  ! long read_client_block (request_rec *r, char *buffer, int bufsiz)
    {
        long c, len_read, len_to_read = r->remaining;
    
  --- 1141,1147 ----
        return (c == EOF) ? -1 : chunksize;
    }
    
  ! long get_client_block (request_rec *r, char *buffer, int bufsiz)
    {
        long c, len_read, len_to_read = r->remaining;
    
  
  
  
  1.9       +2 -2      apache/src/http_protocol.h
  
  Index: http_protocol.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_protocol.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -C3 -r1.8 -r1.9
  *** http_protocol.h	1996/08/20 11:50:50	1.8
  --- http_protocol.h	1996/10/08 21:46:59	1.9
  ***************
  *** 50,56 ****
     *
     */
    
  ! /* $Id: http_protocol.h,v 1.8 1996/08/20 11:50:50 paul Exp $ */
    
    /*
     * Prototypes for routines which either talk directly back to the user,
  --- 50,56 ----
     *
     */
    
  ! /* $Id: http_protocol.h,v 1.9 1996/10/08 21:46:59 brian Exp $ */
    
    /*
     * Prototypes for routines which either talk directly back to the user,
  ***************
  *** 133,139 ****
         
    int setup_client_block (request_rec *r);
    int should_client_block (request_rec *r);
  ! long read_client_block (request_rec *r, char *buffer, int bufsiz);
    
    /* Sending a byterange */
    
  --- 133,139 ----
         
    int setup_client_block (request_rec *r);
    int should_client_block (request_rec *r);
  ! long get_client_block (request_rec *r, char *buffer, int bufsiz);
    
    /* Sending a byterange */
    
  
  
  
  1.19      +2 -2      apache/src/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_cgi.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -C3 -r1.18 -r1.19
  *** mod_cgi.c	1996/08/23 18:19:13	1.18
  --- mod_cgi.c	1996/10/08 21:47:00	1.19
  ***************
  *** 50,56 ****
     *
     */
    
  ! /* $Id: mod_cgi.c,v 1.18 1996/08/23 18:19:13 jim Exp $ */
    
    /*
     * http_script: keeps all script-related ramblings together.
  --- 50,56 ----
     *
     */
    
  ! /* $Id: mod_cgi.c,v 1.19 1996/10/08 21:47:00 brian Exp $ */
    
    /*
     * http_script: keeps all script-related ramblings together.
  ***************
  *** 424,430 ****
            hard_timeout ("copy script args", r);
            handler = signal (SIGPIPE, SIG_IGN);
        
  ! 	while ((len_read = read_client_block (r, argsbuffer, HUGE_STRING_LEN)))
    	{
    	    if (fwrite (argsbuffer, 1, len_read, script_out) == 0)
    		break;
  --- 424,430 ----
            hard_timeout ("copy script args", r);
            handler = signal (SIGPIPE, SIG_IGN);
        
  ! 	while ((len_read = get_client_block (r, argsbuffer, HUGE_STRING_LEN)))
    	{
    	    if (fwrite (argsbuffer, 1, len_read, script_out) == 0)
    		break;
  
  
  

Mime
View raw message