cvs commit: apache-1.3/src/ap ap_execve.c
martin 98/02/27 01:46:33 Modified:src/ap ap_execve.c Log: Oops! I should never publish a function without actually testing it... ap_execle() forgot to pass argv[0] to the program! Revision ChangesPath 1.7 +6 -5 apache-1.3/src/ap/ap_execve.c Index: ap_execve.c === RCS file: /home/cvs/apache-1.3/src/ap/ap_execve.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- ap_execve.c 1998/02/14 13:51:07 1.6 +++ ap_execve.c 1998/02/27 09:46:31 1.7 @@ -108,7 +108,7 @@ * local argv[] array. The va_arg logic makes sure we do the right thing. * XXX: malloc() is used because we expect to be overlaid soon. */ -int ap_execle(const char *filename, const char *arg, ...) +int ap_execle(const char *filename, const char *argv0, ...) { va_list adummy; char **envp; @@ -116,8 +116,8 @@ int argc, ret; /* First pass: Count arguments on stack */ -va_start(adummy, arg); -for (argc = 0; va_arg(adummy, char *) != NULL; ++argc) { +va_start(adummy, argv0); +for (argc = 1; va_arg(adummy, char *) != NULL; ++argc) { continue; } va_end(adummy); @@ -125,8 +125,9 @@ argv = (char **) malloc((argc + 2) * sizeof(*argv)); /* Pass two --- copy the argument strings into the result space */ -va_start(adummy, arg); -for (argc = 0; (argv[argc] = va_arg(adummy, char *)) != NULL; ++argc) { +va_start(adummy, argv0); +argv[0] = argv0; +for (argc = 1; (argv[argc] = va_arg(adummy, char *)) != NULL; ++argc) { continue; } envp = va_arg(adummy, char **);
cvs commit: apache-1.3/src/modules/proxy proxy_util.c
martin 98/02/27 02:10:24 Modified:src/modules/proxy proxy_util.c Log: I forgot to change all occurrences of CRLF Revision ChangesPath 1.43 +3 -3 apache-1.3/src/modules/proxy/proxy_util.c Index: proxy_util.c === RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -u -r1.42 -r1.43 --- proxy_util.c 1998/02/03 16:50:21 1.42 +++ proxy_util.c 1998/02/27 10:10:20 1.43 @@ -552,15 +552,15 @@ hdrs = (struct hdr_entry *) hdrs_arr-elts; bputs(respline, fp); -bputs(\015\012, fp); +bputs(CRLF, fp); for (i = 0; i hdrs_arr-nelts; i++) { if (hdrs[i].field == NULL) continue; - bvputs(fp, hdrs[i].field, : , hdrs[i].value, \015\012, NULL); + bvputs(fp, hdrs[i].field, : , hdrs[i].value, CRLF, NULL); table_set(r-headers_out, hdrs[i].field, hdrs[i].value); } -bputs(\015\012, fp); +bputs(CRLF, fp); }
cvs commit: apache-1.3/src/modules/proxy mod_proxy.c mod_proxy.h proxy_util.c
martin 98/02/27 02:18:42 Modified:src/modules/proxy mod_proxy.c mod_proxy.h proxy_util.c Log: Add pool to interfaces of proxy_is_XXX functions (needed for future expansion) Revision ChangesPath 1.39 +4 -3 apache-1.3/src/modules/proxy/mod_proxy.c Index: mod_proxy.c === RCS file: /home/cvs/apache-1.3/src/modules/proxy/mod_proxy.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -u -r1.38 -r1.39 --- mod_proxy.c 1998/02/23 08:04:10 1.38 +++ mod_proxy.c 1998/02/27 10:18:38 1.39 @@ -530,20 +530,20 @@ fprintf(stderr, Parsed mask %s\n, inet_ntoa(New-mask)); #endif } - else if (proxy_is_domainname(New)) { + else if (proxy_is_domainname(New, parms-pool)) { str_tolower(New-name); #if DEBUGGING fprintf(stderr, Parsed domain %s\n, New-name); #endif } - else if (proxy_is_hostname(New)) { + else if (proxy_is_hostname(New, parms-pool)) { str_tolower(New-name); #if DEBUGGING fprintf(stderr, Parsed host %s\n, New-name); #endif } else { - proxy_is_word(New); + proxy_is_word(New, parms-pool); #if DEBUGGING fprintf(stderr, Parsed word %s\n, New-name); #endif @@ -708,6 +708,7 @@ new-name = arg; /* Don't do name lookups on things that aren't dotted */ if (strchr(arg, '.') != NULL proxy_host2addr(new-name, hp) == NULL) + /*@@@FIXME: This copies only the first of (possibly many) IP addrs */ memcpy(new-addr, hp.h_addr, sizeof(struct in_addr)); else new-addr.s_addr = 0; 1.29 +4 -4 apache-1.3/src/modules/proxy/mod_proxy.h Index: mod_proxy.h === RCS file: /home/cvs/apache-1.3/src/modules/proxy/mod_proxy.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -u -r1.28 -r1.29 --- mod_proxy.h 1998/02/23 08:04:10 1.28 +++ mod_proxy.h 1998/02/27 10:18:39 1.29 @@ -286,9 +286,9 @@ BUFF *proxy_cache_error(struct cache_req *r); int proxyerror(request_rec *r, const char *message); const char *proxy_host2addr(const char *host, struct hostent *reqhp); -int proxy_is_ipaddr(struct dirconn_entry *This); -int proxy_is_domainname(struct dirconn_entry *This); -int proxy_is_hostname(struct dirconn_entry *This); -int proxy_is_word(struct dirconn_entry *This); +int proxy_is_ipaddr(struct dirconn_entry *This, pool *p); +int proxy_is_domainname(struct dirconn_entry *This, pool *p); +int proxy_is_hostname(struct dirconn_entry *This, pool *p); +int proxy_is_word(struct dirconn_entry *This, pool *p); int proxy_doconnect(int sock, struct sockaddr_in *addr, request_rec *r); int proxy_garbage_init(server_rec *, pool *); 1.44 +8 -4 apache-1.3/src/modules/proxy/proxy_util.c Index: proxy_util.c === RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -u -r1.43 -r1.44 --- proxy_util.c 1998/02/27 10:10:20 1.43 +++ proxy_util.c 1998/02/27 10:18:40 1.44 @@ -867,7 +867,7 @@ } /* Return TRUE if addr represents an IP address (or an IP network address) */ -int proxy_is_ipaddr(struct dirconn_entry *This) +int proxy_is_ipaddr(struct dirconn_entry *This, pool *p) { const char *addr = This-name; long ip_addr[4]; @@ -1054,7 +1054,7 @@ } /* Return TRUE if addr represents a domain name */ -int proxy_is_domainname(struct dirconn_entry *This) +int proxy_is_domainname(struct dirconn_entry *This, pool *p) { char *addr = This-name; int i; @@ -1066,10 +1066,12 @@ /* rfc1035 says DNS names must consist of [-a-zA-Z0-9] and '.' */ for (i = 0; isalnum(addr[i]) || addr[i] == '-' || addr[i] == '.'; ++i); +#if 0 if (addr[i] == ':') { fprintf(stderr, handle optional port in proxy_is_domainname()\n); /* handle optional port */ } +#endif if (addr[i] != '\0') return 0; @@ -1104,7 +1106,7 @@ } /* Return TRUE if addr represents a host name */ -int proxy_is_hostname(struct dirconn_entry *This) +int proxy_is_hostname(struct dirconn_entry *This, pool *p) { char *addr = This-name; int i; @@ -1116,10 +1118,12 @@ /* rfc1035 says DNS names must consist of [-a-zA-Z0-9] and '.' */ for (i = 0; isalnum(addr[i]) || addr[i] == '-' || addr[i] == '.'; ++i); +#if 0 if (addr[i] == ':') { fprintf(stderr, handle optional port in proxy_is_hostname()\n); /* handle optional port */ } +#endif if (addr[i] != '\0' ||
cvs commit: apache-1.3/src/modules/standard mod_rewrite.c
rse 98/02/27 06:31:13 Modified:src/modules/standard mod_rewrite.c Log: fixed a comment and added even more comments for better understanding. Revision ChangesPath 1.76 +9 -4 apache-1.3/src/modules/standard/mod_rewrite.c Index: mod_rewrite.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- mod_rewrite.c 1998/02/26 11:13:40 1.75 +++ mod_rewrite.c 1998/02/27 14:31:11 1.76 @@ -1760,9 +1760,13 @@ */ if (strcmp(output, -) == 0) { for (i = 0; p-env[i] != NULL; i++) { +/* 1. take the string */ ap_cpystrn(env, p-env[i], sizeof(env)); +/* 2. expand $N (i.e. backrefs to RewriteRule pattern) */ expand_backref_inbuffer(r-pool, env, sizeof(env), briRR, '$'); +/* 3. expand %N (i.e. backrefs to latest RewriteCond pattern) */ expand_backref_inbuffer(r-pool, env, sizeof(env), briRC, '%'); +/* and add the variable to Apache's structures */ add_env_variable(r, env); } return 2; @@ -1791,7 +1795,7 @@ /* * Additionally do expansion for the environment variable - * strings (`RewriteCond .. .. [E=string]'). + * strings (`RewriteRule .. .. [E=string]'). */ for (i = 0; p-env[i] != NULL; i++) { /* 1. take the string */ @@ -1953,12 +1957,13 @@ * Construct the string we match against */ -/* expand the regex backreferences from the RewriteRule ($0-$9), - then from the last RewriteCond (%0-%9) and then expand the - variables (%{}) */ +/* 1. take the string */ ap_cpystrn(input, p-input, sizeof(input)); +/* 2. expand $N (i.e. backrefs to RewriteRule pattern) */ expand_backref_inbuffer(r-pool, input, sizeof(input), briRR, '$'); +/* 3. expand %N (i.e. backrefs to latest RewriteCond pattern) */ expand_backref_inbuffer(r-pool, input, sizeof(input), briRC, '%'); +/* 4. expand %{...} (i.e. variables) */ expand_variables_inbuffer(r, input, sizeof(input)); /*
cvs commit: apache-1.3/src Configure
martin 98/02/27 06:45:01 Modified:src Configure Log: SVR4 (at least SINIX) needs -DHAS_DLFCN Revision ChangesPath 1.189 +1 -1 apache-1.3/src/Configure Index: Configure === RCS file: /home/cvs/apache-1.3/src/Configure,v retrieving revision 1.188 retrieving revision 1.189 diff -u -u -r1.188 -r1.189 --- Configure 1998/02/21 17:22:56 1.188 +++ Configure 1998/02/27 14:45:00 1.189 @@ -483,7 +483,7 @@ ;; *-sni-sysv4*) OS='SVR4' - CFLAGS=$CFLAGS -DSVR4 -D_XPG_IV -DUSE_MMAP_FILES -DUSE_SYSVSEM_SERIALIZED_ACCEPT -DNEED_UNION_SEMUN + CFLAGS=$CFLAGS -DSVR4 -D_XPG_IV -DHAS_DLFCN -DUSE_MMAP_FILES -DUSE_SYSVSEM_SERIALIZED_ACCEPT -DNEED_UNION_SEMUN DEF_WANTHSREGEX=yes LIBS=$LIBS -lsocket -lnsl -lc ;;
cvs commit: apache-1.3/src/modules/proxy mod_proxy.c
martin 98/02/27 06:47:16 Modified:src/modules/proxy mod_proxy.c Log: Sorry -- Forgot one pool argument in previous patch Revision ChangesPath 1.40 +1 -1 apache-1.3/src/modules/proxy/mod_proxy.c Index: mod_proxy.c === RCS file: /home/cvs/apache-1.3/src/modules/proxy/mod_proxy.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -u -r1.39 -r1.40 --- mod_proxy.c 1998/02/27 10:18:38 1.39 +++ mod_proxy.c 1998/02/27 14:47:15 1.40 @@ -524,7 +524,7 @@ New = push_array(conf-dirconn); New-name = arg; - if (proxy_is_ipaddr(New)) { + if (proxy_is_ipaddr(New, parms-pool)) { #if DEBUGGING fprintf(stderr, Parsed addr %s\n, inet_ntoa(New-addr)); fprintf(stderr, Parsed mask %s\n, inet_ntoa(New-mask));
cvs commit: apache-1.3/src/modules/standard mod_rewrite.c
rse 98/02/27 06:47:48 Modified:src/modules/standard mod_rewrite.c Log: It's unbelievable, it's unbelievable... We have three locations where one can construct a string in rewriting rules by expanding $N, %N, %{NAME} and ${map:key}: - RewriteCond Location-1 ... - RewriteRule ... Location-2 ... - RewriteRule ... ... [..,E=NAME:Location-3,...] And just after I've added exact comments of what we expand in each location, I discovered that they are expanded totally inconsequent. For Location-3 the %{NAME} and ${map:key} constructs were not expanded (ok, perhaps not really a %major drawback) and for Location-1 the ${map:key} construct was not %expanded while for Location-2 all are expanded. At least the missing ${map:key} expansion for Location-1 is horrible because this way we unnesessarily restricted the usefulness of RewriteCond dramatically. Perhaps I should add more source comments to mod_rewrite.c to discover that it then can even can cook a cake now ;-) Revision ChangesPath 1.77 +10 -0 apache-1.3/src/modules/standard/mod_rewrite.c Index: mod_rewrite.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- mod_rewrite.c 1998/02/27 14:31:11 1.76 +++ mod_rewrite.c 1998/02/27 14:47:46 1.77 @@ -1766,6 +1766,10 @@ expand_backref_inbuffer(r-pool, env, sizeof(env), briRR, '$'); /* 3. expand %N (i.e. backrefs to latest RewriteCond pattern) */ expand_backref_inbuffer(r-pool, env, sizeof(env), briRC, '%'); +/* 4. expand %{...} (i.e. variables) */ +expand_variables_inbuffer(r, env, sizeof(env)); +/* 5. expand ${...} (RewriteMap lookups) */ +expand_map_lookups(r, env, sizeof(env)); /* and add the variable to Apache's structures */ add_env_variable(r, env); } @@ -1804,6 +1808,10 @@ expand_backref_inbuffer(r-pool, env, sizeof(env), briRR, '$'); /* 3. expand %N (i.e. backrefs to latest RewriteCond pattern) */ expand_backref_inbuffer(r-pool, env, sizeof(env), briRC, '%'); +/* 4. expand %{...} (i.e. variables) */ +expand_variables_inbuffer(r, env, sizeof(env)); +/* 5. expand ${...} (RewriteMap lookups) */ +expand_map_lookups(r, env, sizeof(env)); /* and add the variable to Apache's structures */ add_env_variable(r, env); } @@ -1965,6 +1973,8 @@ expand_backref_inbuffer(r-pool, input, sizeof(input), briRC, '%'); /* 4. expand %{...} (i.e. variables) */ expand_variables_inbuffer(r, input, sizeof(input)); +/* 5. expand ${...} (RewriteMap lookups) */ +expand_map_lookups(r, input, sizeof(input)); /* * Apply the patterns
cvs commit: apache-1.3/src CHANGES
rse 98/02/27 06:55:04 Modified:src CHANGES Log: Document the now achieved equality of possible meta-construct expansions in mod_rewrite rulesets. Revision ChangesPath 1.670 +7 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.669 retrieving revision 1.670 diff -u -r1.669 -r1.670 --- CHANGES 1998/02/26 11:04:01 1.669 +++ CHANGES 1998/02/27 14:55:02 1.670 @@ -1,5 +1,12 @@ Changes with Apache 1.3b6 + *) Make all possible meta-construct expansions ($N, %N, %{NAME} and + ${map:key}) available for all location where a string is created in + mod_rewrite rewriting rulesets: 1st arg of RewriteCond, 2nd arg of + RewriteRule and for the [E=NAME:STRING] flag of RewriteRule. This way the + possible expansions are consequently useable at all string creation + locations. [Ralf S. Engelschall] + *) Fix initialization of RewriteLogLevel (default now is 0 as documented and not 1) and the per-virtual-server merging of directives. Now all directives except `RewriteEngine' and `RewriteOption' are either
cvs commit: apache-1.3/src/modules/standard mod_log_config.c
martin 98/02/27 07:15:30 Modified:src CHANGES src/include httpd.h src/main Makefile.tmpl http_main.c http_protocol.c http_request.c http_vhost.c src/modules/proxy mod_proxy.c mod_proxy.h proxy_http.c proxy_util.c src/modules/standard mod_log_config.c Added: src/include util_uri.h src/main util_uri.c Log: For testing purposes, I added a new source called main/util_uri.c; It contains a routine parse_uri_components_regex() and friends which tries to break an URI into its parts. These parts are stored in a new uri_components structure within each request_rec and are therefore available to all routines which act on a request. Additionally, an unparse routine is supplied which re-assembles the URI components back to an URI, optionally hiding the username:password@ part from ftp proxy requests, and other useful routines. Within the structure, you find on a ready-for-use basis: scheme; /* scheme (http/ftp/...) */ hostinfo; /* combined [user[:[EMAIL PROTECTED]:port] */ user; /* user name, as in http://user:[EMAIL PROTECTED]:port/ */ password; /* password, as in http://user:[EMAIL PROTECTED]:port/ */ hostname; /* hostname from URI (or from Host: header) */ port_str; /* port string (integer representation is in port) */ path; /* the request path (or / if only scheme://host was given) */ query; /* Everything after a '?' in the path, if present */ fragment; /* Trailing #fragment string, if present */ plus flags to indicate whether the strings have valid values. This is meant to serve as the platform for *BIG* savings in code complexity for the proxy module (and maybe the vhost logic). NOTE: This code is enabled only if the WITH_UTIL_URI define is set; currently this is not enabled by default. [Martin Kraemer] Reviewed by: Dean Gaudet (on a previous occasion) Revision ChangesPath 1.671 +24 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.670 retrieving revision 1.671 diff -u -u -r1.670 -r1.671 --- CHANGES 1998/02/27 14:55:02 1.670 +++ CHANGES 1998/02/27 15:15:13 1.671 @@ -1,5 +1,29 @@ Changes with Apache 1.3b6 + *) For testing purposes, I added a new source called main/util_uri.c; + It contains a routine parse_uri_components_regex() and friends which + tries to break an URI into its parts. These parts are stored in a new + uri_components structure within each request_rec and are therefore + available to all routines which act on a request. + Additionally, an unparse routine is supplied which re-assembles the + URI components back to an URI, optionally hiding the username:password@ + part from ftp proxy requests, and other useful routines. + Within the structure, you find on a ready-for-use basis: + scheme; /* scheme (http/ftp/...) */ + hostinfo; /* combined [user[:[EMAIL PROTECTED]:port] */ + user; /* user name, as in http://user:[EMAIL PROTECTED]:port/ */ + password; /* password, as in http://user:[EMAIL PROTECTED]:port/ */ + hostname; /* hostname from URI (or from Host: header) */ + port_str; /* port string (integer representation is in port) */ + path; /* the request path (or / if only scheme://host was given) */ + query; /* Everything after a '?' in the path, if present */ + fragment; /* Trailing #fragment string, if present */ + plus flags to indicate whether the strings have valid values. + This is meant to serve as the platform for *BIG* savings in + code complexity for the proxy module (and maybe the vhost logic). + NOTE: This code is enabled only if the WITH_UTIL_URI define is set; + currently this is not enabled by default. [Martin Kraemer] + *) Make all possible meta-construct expansions ($N, %N, %{NAME} and ${map:key}) available for all location where a string is created in mod_rewrite rewriting rulesets: 1st arg of RewriteCond, 2nd arg of 1.188 +7 -0 apache-1.3/src/include/httpd.h Index: httpd.h === RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v retrieving revision 1.187 retrieving revision 1.188 diff -u -u -r1.187 -r1.188 --- httpd.h 1998/02/18 08:39:21 1.187 +++ httpd.h 1998/02/27 15:15:15 1.188 @@ -537,6 +537,10 @@ typedef struct request_rec request_rec; typedef struct listen_rec listen_rec; +#ifdef WITH_UTIL_URI +#include util_uri.h +#endif + struct request_rec { pool *pool; @@ -656,6 +660,9 @@ char *path_info;
cvs commit: apache-1.3/src/main util_uri.c
martin 98/02/27 07:19:56 Modified:src/include util_uri.h src/main util_uri.c Log: Reflect Year-1998 reality Revision ChangesPath 1.2 +1 -1 apache-1.3/src/include/util_uri.h Index: util_uri.h === RCS file: /home/cvs/apache-1.3/src/include/util_uri.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- util_uri.h1998/02/27 15:15:15 1.1 +++ util_uri.h1998/02/27 15:19:54 1.2 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995-1997 The Apache Group. All rights reserved. + * Copyright (c) 1998 The Apache Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions 1.2 +1 -1 apache-1.3/src/main/util_uri.c Index: util_uri.c === RCS file: /home/cvs/apache-1.3/src/main/util_uri.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- util_uri.c1998/02/27 15:15:22 1.1 +++ util_uri.c1998/02/27 15:19:55 1.2 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995-1997 The Apache Group. All rights reserved. + * Copyright (c) 1998 The Apache Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions
cvs commit: apache-1.3/src/main Makefile.tmpl
martin 98/02/27 07:26:06 Modified:src/main Makefile.tmpl Log: Dean, this 'make depend' stuff was a great job Revision ChangesPath 1.14 +4 -0 apache-1.3/src/main/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-1.3/src/main/Makefile.tmpl,v retrieving revision 1.13 retrieving revision 1.14 diff -u -u -r1.13 -r1.14 --- Makefile.tmpl 1998/02/27 15:15:18 1.13 +++ Makefile.tmpl 1998/02/27 15:26:05 1.14 @@ -125,3 +125,7 @@ $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h \ $(INCDIR)/http_core.h $(INCDIR)/http_request.h \ $(INCDIR)/util_script.h $(INCDIR)/util_date.h +util_uri.o: util_uri.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \ + ../os/unix/os.h $(INCDIR)/hsregex.h $(INCDIR)/alloc.h \ + $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_conf_globals.h $(INCDIR)/util_uri.h