httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@hyperreal.com>
Subject cvs commit: apache/src http_protocol.c
Date Mon, 19 Aug 1996 18:05:34 GMT
akosut      96/08/19 11:05:34

  Modified:    src       http_protocol.c
  Log:
  Make Apache correctly read continued headers
  
  Submitted by: Paul Sutton
  Reviewed by: Alexei Kosut, Roy T. Fielding
  
  Revision  Changes    Path
  1.40      +36 -8     apache/src/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -C3 -r1.39 -r1.40
  *** http_protocol.c	1996/08/19 17:22:56	1.39
  --- http_protocol.c	1996/08/19 18:05:32	1.40
  ***************
  *** 530,545 ****
        char w[MAX_STRING_LEN];
        char *t;
        conn_rec *c = r->connection;
    
  !     while(getline(w, MAX_STRING_LEN-1, c->client)) {
  !         if(!w[0]) 
  !             return;
  !         if(!(t = strchr(w,':')))
  !             continue;
  !         *t++ = '\0';
  !         while(isspace(*t)) ++t;
    
  ! 	table_merge (r->headers_in, w, t);
        }
    }
    
  --- 530,573 ----
        char w[MAX_STRING_LEN];
        char *t;
        conn_rec *c = r->connection;
  +     int len = 0;
  +     char lookahead[2];
    
  !     if (getline(w, MAX_STRING_LEN-1, c->client)) {
  !         do {
  ! 	    if(!w[len])
  ! 	        return;
  ! 	    /* w[] contains the _current_ line. Lets read the
  ! 	     * first char of the _next_ line into lookahead[] and see
  ! 	     * if it is a continuation line */
  ! 	    if (!getline(lookahead, 2, c->client) ||
  ! 		*lookahead == '\0' ||
  ! 		(*lookahead != ' ' && *lookahead != '\t')) {
  !  	        /* Not a continuation line -- _next_ line is either
  ! 		 * a read error, empty, or doesn't start with SPACE or TAB
  ! 		 * -- so store the _current_ line now */
  ! 		if(!(t = strchr(w,':')))
  ! 		    continue;
  ! 		*t++ = '\0';
  ! 		while(isspace(*t)) ++t;
    
  ! 		table_merge (r->headers_in, w, t);
  ! 
  ! 		if (!*lookahead) /* did we read an empty line? */
  ! 		    return;
  ! 
  ! 		/* Put what we read as the start of the new _current_ line */
  ! 		w[0] = '\0';
  ! 	    }
  ! 	    /* To get here, here have got a lookahead character in
  ! 	     * *lookahead, so append it onto the end of w[], then
  ! 	     * read the next line onto the end of that. Move
  ! 	     * len on to point to the first char read from the next
  ! 	     * line of input... we use this at the top of the loop
  ! 	     * to check whether we actually read anything. */
  !  	} while (len = strlen(w),
  ! 		 w[len++] = *lookahead,
  ! 		 getline (w+len, MAX_STRING_LEN-1-len, c->client));
        }
    }
    
  
  
  

Mime
View raw message