httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: [PATCH] PR#979: fix mod_include logging a little...
Date Mon, 07 Jul 1997 17:20:38 GMT
I think you mean PR#797.  +1. 

Dean

On Sun, 6 Jul 1997, Marc Slemko wrote:

> This fixes the logging from mod_include a little.
> 
> Note that mod_include really needs its own internal log_include or
> something to get rid of some of this duplication and standardize a 
> format.  
> 
> Problems include:
> 	- fix wrong message for execution failure
> 	- add some quotes around the thing causing the problem
> 	- make the number of slots in the string agree with the
> 	  number of params.
> 
> 
> Index: mod_include.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/mod_include.c,v
> retrieving revision 1.38
> diff -u -r1.38 mod_include.c
> --- mod_include.c	1997/06/29 17:38:02	1.38
> +++ mod_include.c	1997/07/07 02:29:51
> @@ -462,7 +462,7 @@
>              var[vlen] = vtext[vtlen] = '\0';
>              if (braces == 1) {
>                  if (*in != '}') {
> -                    log_printf(r->server, "Invalid variable %s%s", vtext,in);
> +                    log_printf(r->server, "Invalid variable \"%s%s\"", vtext,in);
>                      *next = '\0';
>                      return;
>                  } else
> @@ -549,19 +549,19 @@
>  		char tmp[MAX_STRING_LEN+2];
>  		ap_snprintf(tmp, sizeof(tmp), "/%s/", parsed_string);
>  		if (parsed_string[0] == '/' || strstr(tmp, "/../") != NULL)
> -		    error_fmt = "unable to include file %s in parsed file %s";
> +		    error_fmt = "unable to include file \"%s\" in parsed file %s";
>  		else
>  		    rr = sub_req_lookup_file (parsed_string, r);
>  	    } else
>  		rr = sub_req_lookup_uri (parsed_string, r);
>  	    
>  	    if (!error_fmt && rr->status != 200)
> -	        error_fmt = "unable to include %s in parsed file %s";
> +	        error_fmt = "unable to include \"%s\" in parsed file %s";
>  
>  	    if (!error_fmt && noexec && rr->content_type
>  		&& (strncmp (rr->content_type, "text/", 5)))
>  	        error_fmt =
> -		  "unable to include potential exec %s in parsed file %s";
> +		  "unable to include potential exec \"%s\" in parsed file %s";
>              if (error_fmt == NULL)
>              {
>                  request_rec *p;
> @@ -569,11 +569,11 @@
>                  for (p=r; p != NULL; p=p->main)
>                      if (strcmp(p->filename, rr->filename) == 0) break;
>                  if (p != NULL)
> -                    error_fmt = "Recursive include of %s in parsed file %s";
> +                    error_fmt = "Recursive include of \"%s\" in parsed file %s";
>              }
>  	    
>  	    if (!error_fmt && run_sub_req (rr))
> -	        error_fmt = "unable to include %s in parsed file %s";
> +	        error_fmt = "unable to include \"%s\" in parsed file %s";
>  	    chdir_file(r->filename);
>  		    
>              if (error_fmt) {
> @@ -586,7 +586,7 @@
>          else if(!strcmp(tag,"done"))
>              return 0;
>          else {
> -            log_printf(r->server, "unknown parameter %s to tag include in %s",
> +            log_printf(r->server, "unknown parameter \"%s\" to tag include in %s",
>                         tag, r->filename);
>              rputs(error, r);
>          }
> @@ -701,8 +701,8 @@
>          if(!strcmp(tag,"cmd")) {
>              parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 1);
>              if(include_cmd(parsed_string, r) == -1) {
> -                log_printf(r->server, "unknown parameter %s to tag include in %s",
> -                           tag, r->filename);
> +                log_printf(r->server, "execution failure for parameter \"%s\" to
tag exec in file %s", 
> +                tag, r->filename);
>                  rputs(error, r);
>              }
>              /* just in case some stooge changed directories */
> @@ -711,7 +711,7 @@
>          else if(!strcmp(tag,"cgi")) {
>              parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 0);
>              if(include_cgi(parsed_string, r) == -1) {
> -                log_printf(r->server, "invalid CGI ref %s in %s",tag_val,file);
> +                log_printf(r->server, "invalid CGI ref \"%s\" in %s",tag_val,file);
>                  rputs(error, r);
>              }
>              /* grumble groan */
> @@ -720,7 +720,7 @@
>          else if(!strcmp(tag,"done"))
>              return 0;
>          else {
> -            log_printf(r->server, "unknown parameter %s to tag exec in %s",
> +            log_printf(r->server, "unknown parameter \"%s\" to tag exec in %s",
>                         tag, file);
>              rputs(error, r);
>          }
> @@ -743,7 +743,7 @@
>          } else if(!strcmp(tag,"done"))
>              return 0;
>          else {
> -            log_printf(r->server, "unknown parameter %s to tag echo in %s",
> +            log_printf(r->server, "unknown parameter \"%s\" to tag echo in %s",
>                  tag, r->filename);
>              rputs(error, r);
>          }
> @@ -814,7 +814,7 @@
>          else if(!strcmp(tag,"done"))
>              return 0;
>          else {
> -            log_printf(r->server,"unknown parameter %s to tag config in %s",
> +            log_printf(r->server,"unknown parameter \"%s\" to tag config in %s",
>                      tag, r->filename);
>              rputs(error, r);
>          }
> @@ -834,7 +834,7 @@
>          to_send = make_full_path (r->pool, dir, tag_val);
>          if(stat(to_send,finfo) == -1) {
>              log_printf(r->server,
> -                    "unable to get information about %s in parsed file %s",
> +                    "unable to get information about \"%s\" in parsed file %s",
>                      to_send, r->filename);
>              rputs(error, r);
>              return -1;
> @@ -850,7 +850,7 @@
>  	    return 0;
>          } else {
>              log_printf(r->server,
> -                    "unable to get information about %s in parsed file %s",
> +                    "unable to get information about \"%s\" in parsed file %s",
>                      tag_val, r->filename);
>              rputs(error, r);
>  	    destroy_sub_req (rr);
> @@ -858,7 +858,7 @@
>          }
>      }
>      else {
> -        log_printf(r->server,"unknown parameter %s to tag %s in %s",
> +        log_printf(r->server,"unknown parameter \"%s\" to tag %s in %s",
>                  tag, directive, r->filename);
>          rputs(error, r);
>          return -1;
> @@ -932,7 +932,7 @@
>  
>      compiled = pregcomp (r->pool, rexp, REG_EXTENDED|REG_NOSUB);
>      if (compiled == NULL) {
> -        log_printf(r->server, "unable to compile pattern %s", rexp);
> +        log_printf(r->server, "unable to compile pattern \"%s\"", rexp);
>          return -1;
>      }
>      regex_error = regexec(compiled, string, 0, (regmatch_t *)NULL, 0);
> @@ -1060,7 +1060,7 @@
>      if ((parse = expr) == (char *)NULL) return(0);
>      root = current = (struct parse_node*)NULL;
>      if ((expr_pool = make_sub_pool(r->pool)) == (struct pool *)NULL) {
> -        log_printf(r->server, "out of memory", r->filename);
> +        log_printf(r->server, "out of memory processing file %s", r->filename);
>          rputs(error, r);
>          return(0);
>      }
> @@ -1069,7 +1069,7 @@
>      while (1) {
>          new = (struct parse_node*)palloc(expr_pool, sizeof (struct parse_node));
>          if (new == (struct parse_node*)NULL) {
> -            log_printf(r->server,"out of memory", r->filename);
> +            log_printf(r->server,"out of memory processing file %s", r->filename);
>              rputs(error, r);
>              goto RETURN;
>          }
> @@ -1106,7 +1106,7 @@
>                  break;
>                default:
>                  log_printf(r->server,
> -                    "Invalid expression %s", expr, r->filename);
> +                    "Invalid expression \"%s\" in file %s", expr, r->filename);
>                  rputs(error, r);
>                  goto RETURN;
>              }
> @@ -1119,7 +1119,7 @@
>  #endif
>              if (current == (struct parse_node*)NULL) {
>                  log_printf(r->server,
> -                    "Invalid expression %s", expr, r->filename);
> +                    "Invalid expression \"%s\" in file %s", expr, r->filename);
>                  rputs(error, r);
>                  goto RETURN;
>              }
> @@ -1139,7 +1139,7 @@
>                      break;
>                    default:
>                      log_printf(r->server,
> -                        "Invalid expression %s", expr, r->filename);
> +                        "Invalid expression \"%s\" in file %s", expr, r->filename);
>                      rputs(error, r);
>                      goto RETURN;
>                  }
> @@ -1178,7 +1178,7 @@
>                      break;
>                    default:
>                      log_printf(r->server,
> -                        "Invalid expression %s", expr, r->filename);
> +                        "Invalid expression \"%s\" in file %s", expr, r->filename);
>                      rputs(error, r);
>                      goto RETURN;
>                  }
> @@ -1204,7 +1204,7 @@
>  #endif
>              if (current == (struct parse_node*)NULL) {
>                  log_printf(r->server,
> -                    "Invalid expression %s", expr, r->filename);
> +                    "Invalid expression \"%s\" in file %s", expr, r->filename);
>                  rputs(error, r);
>                  goto RETURN;
>              }
> @@ -1223,8 +1223,9 @@
>                    case token_eq:
>                    case token_ne:
>                    default:
> -                    log_printf(r->server,
> -                        "Invalid expression %s", expr, r->filename);
> +                    log_printf(r->server, 
> +                        "Invalid expression \"%s\" in file %s", 
> +                        expr, r->filename);
>                      rputs(error, r);
>                      goto RETURN;
>                  }
> @@ -1255,7 +1256,7 @@
>                  current = current->parent;
>              }
>              if (current == (struct parse_node*)NULL) {
> -                log_printf(r->server,"Unmatched ')'in %s\n", expr, r->filename);
> +                log_printf(r->server,"Unmatched ')' in %s", expr, r->filename);
>                  rputs(error, r);
>                  goto RETURN;
>              }
> @@ -1283,7 +1284,8 @@
>                    case token_group:
>                    default:
>                      log_printf(r->server,
> -                        "Invalid expression %s", expr, r->filename);
> +                        "Invalid expression \"%s\" in file %s", 
> +			expr, r->filename);
>                      rputs(error, r);
>                      goto RETURN;
>                  }
> @@ -1330,7 +1332,7 @@
>              if (current->left == (struct parse_node*)NULL ||
>                          current->right == (struct parse_node*)NULL) {
>                  log_printf(r->server,
> -                    "Invalid expression %s", expr, r->filename);
> +                    "Invalid expression \"%s\" in file %s", expr, r->filename);
>                  rputs(error, r);
>                  goto RETURN;
>              }
> @@ -1391,7 +1393,7 @@
>                          (current->left->token.type != token_string) ||
>                          (current->right->token.type != token_string)) {
>                  log_printf(r->server,
> -                    "Invalid expression %s", expr, r->filename);
> +                    "Invalid expression \"%s\" in file %s", expr, r->filename);
>                  rputs(error, r);
>                  goto RETURN;
>              }
> @@ -1409,7 +1411,7 @@
>                  if (current->right->token.value[len-1] == '/') {
>                      current->right->token.value[len-1] = '\0';
>                  } else {
> -                    log_printf(r->server,"Invalid rexp %s",
> +                    log_printf(r->server,"Invalid rexp \"%s\" in file %s",
>                              current->right->token.value, r->filename);
>                      rputs(error, r);
>                      goto RETURN;
> @@ -1474,12 +1476,14 @@
>              break;
>  
>            case token_lbrace:
> -            log_printf(r->server,"Unmatched '(' in %s\n", expr, r->filename);
> +            log_printf(r->server,"Unmatched '(' in %s in file %s", 
> +		expr, r->filename);
>              rputs(error, r);
>              goto RETURN;
>  
>            case token_rbrace:
> -            log_printf(r->server,"Unmatched ')' in %s\n", expr, r->filename);
> +            log_printf(r->server,"Unmatched ')' in %s in file %s\n", 
> +		expr, r->filename);
>              rputs(error, r);
>              goto RETURN;
>  
> @@ -1519,7 +1523,7 @@
>  rvputs(r,"**** if expr=\"", expr, "\"\n", NULL);
>  #endif
>          } else {
> -            log_printf(r->server,"unknown parameter %s to tag if in %s",
> +            log_printf(r->server,"unknown parameter \"%s\" to tag if in %s",
>                      tag, r->filename);
>              rputs(error, r);
>          }
> @@ -1556,7 +1560,7 @@
>  rvputs(r,"**** if expr=\"", expr, "\"\n", NULL);
>  #endif
>          } else {
> -            log_printf(r->server,"unknown parameter %s to tag if in %s",
> +            log_printf(r->server,"unknown parameter \"%s\" to tag if in %s",
>                      tag, r->filename);
>              rputs(error, r);
>          }
> @@ -1748,7 +1752,7 @@
>  #endif
>              else {
>                  log_printf(r->server,
> -                        "httpd: unknown directive %s in parsed doc %s",
> +                        "httpd: unknown directive \"%s\" in parsed doc %s",
>                          directive,r->filename);
>                  if (printing) rputs(error, r);
>                  ret=find_string(f,ENDING_SEQUENCE,r,0);
> 
> 


Mime
View raw message