You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Alexei Kosut <ak...@hyperreal.com> on 1996/08/19 19:54:53 UTC

cvs commit: apache/src util.c

akosut      96/08/19 10:54:53

  Modified:    src       util.c
  Log:
  Fix backslash-quoting in getword_conf()
  
  Reviewed by: Roy T. Fielding, Someone Else (I forget who, exactly)
  
  Revision  Changes    Path
  1.16      +8 -7      apache/src/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/util.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -C3 -r1.15 -r1.16
  *** util.c	1996/07/29 02:32:34	1.15
  --- util.c	1996/08/19 17:54:52	1.16
  ***************
  *** 458,471 ****
     * all honored
     */
    
  ! char *substring_conf (pool *p, char *start, int len)
    {
        char *result = palloc (p, len + 2);
        char *resp = result;
        int i;
    
        for (i = 0; i < len; ++i) {
  !         if (start[i] == '\\') 
    	    *resp++ = start[++i];
    	else
    	    *resp++ = start[i];
  --- 458,472 ----
     * all honored
     */
    
  ! char *substring_conf (pool *p, char *start, int len, char quote)
    {
        char *result = palloc (p, len + 2);
        char *resp = result;
        int i;
    
        for (i = 0; i < len; ++i) {
  !         if (start[i] == '\\' && (start[i+1] == '/'
  ! 				 || (quote && start[i+1] == quote)))
    	    *resp++ = start[++i];
    	else
    	    *resp++ = start[i];
  ***************
  *** 490,508 ****
        if ((quote = *str) == '"' || quote == '\'') {
            strend = str + 1;
    	while (*strend && *strend != quote) {
  ! 	    if (*strend == '\\' && strend[1]) strend += 2;
    	    else ++strend;
    	}
  ! 	res = substring_conf (p, str + 1, strend - str - 1);
    
    	if (*strend == quote) ++strend;
        } else {
            strend = str;
    	while (*strend && !isspace (*strend))
  ! 	    if (*strend == '\\' && strend[1]) strend += 2;
  ! 	    else ++strend;
    
  ! 	res = substring_conf (p, str, strend - str);
        }
    
        while (*strend && isspace(*strend)) ++ strend;
  --- 491,509 ----
        if ((quote = *str) == '"' || quote == '\'') {
            strend = str + 1;
    	while (*strend && *strend != quote) {
  ! 	    if (*strend == '\\' && strend[1] && strend[1] == quote)
  ! 		strend += 2;
    	    else ++strend;
    	}
  ! 	res = substring_conf (p, str + 1, strend - str - 1, quote);
    
    	if (*strend == quote) ++strend;
        } else {
            strend = str;
    	while (*strend && !isspace (*strend))
  ! 	    ++strend;
    
  ! 	res = substring_conf (p, str, strend - str, 0);
        }
    
        while (*strend && isspace(*strend)) ++ strend;