You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1997/07/09 14:34:48 UTC
[SYNC] mod_rewrite 3.0.8
Below is the context diff for syncing the CVS source of mod_rewrite with the
current release 3.0.8. The ChangeLog entries follow (note that the NT-porting
#ifdef's will be removed for final Apache 1.3, but currently 1.2.1 is the
release and mod_rewrite should compile with this version, too):
Changes between 3.0.7 and 3.0.8
===============================
970706 - incorporated a bugfix which fixes a problem with the response
code on redirects.
[Thanks to Marc Slemko <ma...@znep.com> for patch]
- slightly changed the documentation: solutions.src
- disable the locking of the RewriteMap child pipe
under SunOS 4.1.x because this OS does us not allow to lock pipes.
Here without locking should work ats least _most of the time_, but
its better this way than it does not work completely.
970708 - allow env variables to be set even on rules with no
substitution part ("-").
[Thanks to Peter Hegedus <he...@iworld.com> for patch]
- bugfix: now when HostnameLookups is off and get_host_name() returns
NULL the logfile says "UNKNOWN-HOST" instead of passing NULL to the
pstrdup function.
- changed the MODULE_MAGIC_NUMBER checks because Apache 1.2.1
has 19970622 as its value.
- changed a few left-over static variables
to non-static ones to make mod_rewrite more thread-safe.
[Thanks to Dean Gaudet <dg...@arctic.org>]
Changes between 3.0.6 and 3.0.7
===============================
970622 - incorporated the NT-porting changes from
the Apache Groups 1.3-dev version.
970624 - fixed a problem when creating a empty
query string via "xxx?". Now it is possible
to actually remove an existing query string.
[Thanks to "Taso N. Devetzis" <de...@snet.net> for hint]
- made mod_rewrite compile again without warnings
under "old" Apache 1.2.0.
BTW: Yes, I hate it to sync the stuff all the time, too. Instead
I would really prefer to maintain the code _FOR_ and _AT_ the Apache
Groups repository. But because the Apache Group never gave me group
ownership _including_ CVS access, I'm still forced to maintain my own
(official) copy of the mod_rewrite sources. Sorry, but I don't want to
give my own code away and maintain it in a way where I don't have direct
access too it any longer. (Yes, I know, voting is always needed, but
thats not the point). I've discussed this two times with the group in the
past and although most of the members agreed with me I still don't have
CVS access. Hmmm, the group will have reasons, I'm sure...
Greetings,
Ralf S. Engelschall
rse@engelschall.com
www.engelschall.com
*** mod_rewrite.c.old Sun Jun 22 09:00:14 1997
--- mod_rewrite.c Wed Jul 9 12:45:56 1997
***************
*** 61,67 ****
** |_| |_| |_|\___/ \__,_|___|_| \___| \_/\_/ |_| |_|\__\___|
** |_____|
**
! ** URL Rewriting Module, Version 3.0.6 (15-Jun-1997)
**
** This module uses a rule-based rewriting engine (based on a
** regular-expression parser) to rewrite requested URLs on the fly.
--- 61,67 ----
** |_| |_| |_|\___/ \__,_|___|_| \___| \_/\_/ |_| |_|\__\___|
** |_____|
**
! ** URL Rewriting Module, Version 3.0.8 (09-Jul-1997)
**
** This module uses a rule-based rewriting engine (based on a
** regular-expression parser) to rewrite requested URLs on the fly.
***************
*** 1503,1510 ****
return 0; /* if any condition fails this complete rule fails */
/* if this is a pure matching rule we return immediately */
! if (strcmp(output, "-") == 0)
return 2;
/* if this is a forced proxy request ... */
if (p->flags & RULEFLAG_PROXY) {
--- 1503,1519 ----
return 0; /* if any condition fails this complete rule fails */
/* if this is a pure matching rule we return immediately */
! if (strcmp(output, "-") == 0) {
! /* but before we set the env variables... */
! for (i = 0; p->env[i] != NULL; i++) {
! strncpy(env2, p->env[i], sizeof(env2)-1);
! EOS_PARANOIA(env2);
! strncpy(env, pregsub(r->pool, env2, uri, regexp->re_nsub+1, regmatch), sizeof(env)-1); /* substitute in output */
! EOS_PARANOIA(env);
! add_env_variable(r, env);
! }
return 2;
+ }
/* if this is a forced proxy request ... */
if (p->flags & RULEFLAG_PROXY) {
***************
*** 1624,1629 ****
--- 1633,1639 ----
and the current URL still is not a fully qualified one we
finally prefix it with http[s]://<ourname> explicitly */
if (flags & RULEFLAG_FORCEREDIRECT) {
+ r->status = p->forced_responsecode;
if ( !(strlen(r->filename) > 7 &&
strncmp(r->filename, "http://", 7) == 0)
&& !(strlen(r->filename) > 8 &&
***************
*** 1659,1665 ****
else
rewritelog(r, 2, "[per-dir %s] prepare forced redirect %s -> %s", perdir, r->filename, newuri);
r->filename = pstrdup(r->pool, newuri);
- r->status = p->forced_responsecode;
return 1;
}
}
--- 1669,1674 ----
***************
*** 1808,1816 ****
r->args = pstrcat(r->pool, q, "&", r->args, NULL);
else
r->args = pstrdup(r->pool, q);
! if (r->args[strlen(r->args)-1] == '&')
! r->args[strlen(r->args)-1] = '\0';
! rewritelog(r, 3, "split uri=%s -> uri=%s, args=%s", olduri, r->filename, r->args);
}
return;
}
--- 1817,1831 ----
r->args = pstrcat(r->pool, q, "&", r->args, NULL);
else
r->args = pstrdup(r->pool, q);
! if (strlen(r->args) == 0) {
! r->args = NULL;
! rewritelog(r, 3, "split uri=%s -> uri=%s, args=<none>", olduri, r->filename);
! }
! else {
! if (r->args[strlen(r->args)-1] == '&')
! r->args[strlen(r->args)-1] = '\0';
! rewritelog(r, 3, "split uri=%s -> uri=%s, args=%s", olduri, r->filename, r->args);
! }
}
return;
}
***************
*** 2213,2219 ****
--- 2228,2236 ----
int i;
/* lock the channel */
+ #ifdef USE_PIPE_LOCKING
fd_lock(fpin);
+ #endif
/* write out the request key */
write(fpin, key, strlen(key));
***************
*** 2229,2235 ****
--- 2246,2254 ----
buf[i] = '\0';
/* unlock the channel */
+ #ifdef USE_PIPE_LOCKING
fd_unlock(fpin);
+ #endif
if (strcasecmp(buf, "NULL") == 0)
return NULL;
***************
*** 2254,2261 ****
rewrite_server_conf *conf;
char *fname;
FILE *fp;
! static int rewritelog_flags = ( O_WRONLY|O_APPEND|O_CREAT );
! static mode_t rewritelog_mode = ( S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH );
conf = get_module_config(s->module_config, &rewrite_module);
--- 2273,2280 ----
rewrite_server_conf *conf;
char *fname;
FILE *fp;
! int rewritelog_flags = ( O_WRONLY|O_APPEND|O_CREAT );
! mode_t rewritelog_mode = ( S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH );
conf = get_module_config(s->module_config, &rewrite_module);
***************
*** 2288,2294 ****
--- 2307,2317 ----
}
/* Child process code for 'RewriteLog "|..."' */
+ #if MODULE_MAGIC_NUMBER > 19970622
static int rewritelog_child(void *cmd)
+ #else
+ static void rewritelog_child(void *cmd)
+ #endif
{
int child_pid = 1;
***************
*** 2302,2308 ****
--- 2325,2335 ----
#else
execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
#endif
+ #if MODULE_MAGIC_NUMBER > 19970622
return(child_pid);
+ #else
+ return;
+ #endif
}
static void rewritelog(request_rec *r, int level, const char *text, ...)
***************
*** 2310,2323 ****
rewrite_server_conf *conf;
conn_rec *connect;
char *str1;
! static char str2[HUGE_STRING_LEN];
! static char str3[HUGE_STRING_LEN];
! static char type[20];
! static char redir[20];
va_list ap;
int i;
request_rec *req;
char *ruser;
va_start(ap, text);
conf = get_module_config(r->server->module_config, &rewrite_module);
--- 2337,2351 ----
rewrite_server_conf *conf;
conn_rec *connect;
char *str1;
! char str2[512];
! char str3[1024];
! char type[20];
! char redir[20];
va_list ap;
int i;
request_rec *req;
char *ruser;
+ const char *rhost;
va_start(ap, text);
conf = get_module_config(r->server->module_config, &rewrite_module);
***************
*** 2343,2349 ****
ruser = "\"\"";
}
! str1 = pstrcat(r->pool, get_remote_host(connect, r->server->module_config, REMOTE_NAME), " ",
(connect->remote_logname != NULL ? connect->remote_logname : "-"), " ",
ruser, NULL);
ap_vsnprintf(str2, sizeof(str2), text, ap);
--- 2371,2381 ----
ruser = "\"\"";
}
! rhost = get_remote_host(connect, r->server->module_config, REMOTE_NAME);
! if (rhost == NULL)
! rhost = "UNKNOWN-HOST";
!
! str1 = pstrcat(r->pool, rhost, " ",
(connect->remote_logname != NULL ? connect->remote_logname : "-"), " ",
ruser, NULL);
ap_vsnprintf(str2, sizeof(str2), text, ap);
***************
*** 2439,2445 ****
--- 2471,2481 ----
}
/* child process code */
+ #if MODULE_MAGIC_NUMBER > 19970622
static int rewritemap_program_child(void *cmd)
+ #else
+ static void rewritemap_program_child(void *cmd)
+ #endif
{
int child_pid = 1;
***************
*** 2453,2459 ****
--- 2489,2499 ----
#else
execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
#endif
+ #if MODULE_MAGIC_NUMBER > 19970622
return(child_pid);
+ #else
+ return;
+ #endif
}
*** mod_rewrite.h.old Sun Jun 22 09:00:14 1997
--- mod_rewrite.h Wed Jul 9 09:19:29 1997
***************
*** 64,70 ****
** |_| |_| |_|\___/ \__,_|___|_| \___| \_/\_/ |_| |_|\__\___|
** |_____|
**
! ** URL Rewriting Module, Version 3.0.6 (15-Jun-1997)
**
** This module uses a rule-based rewriting engine (based on a
** regular-expression parser) to rewrite requested URLs on the fly.
--- 64,70 ----
** |_| |_| |_|\___/ \__,_|___|_| \___| \_/\_/ |_| |_|\__\___|
** |_____|
**
! ** URL Rewriting Module, Version 3.0.8 (09-Jul-1997)
**
** This module uses a rule-based rewriting engine (based on a
** regular-expression parser) to rewrite requested URLs on the fly.
***************
*** 137,143 ****
#include <fcntl.h>
#endif
!
/*
--- 137,150 ----
#include <fcntl.h>
#endif
! /* The locking support for the RewriteMap programs:
! Locking a pipe to the child works fine under most
! Unix derivates, but braindead SunOS 4.1.x has
! problems with this approach... */
! #define USE_PIPE_LOCKING 1
! #ifdef SUNOS4
! #undef USE_PIPE_LOCKING
! #endif
/*
***************
*** 350,362 ****
--- 357,377 ----
/* rewriting logfile support */
static void open_rewritelog(server_rec *s, pool *p);
+ #if MODULE_MAGIC_NUMBER > 19970622
static int rewritelog_child(void *cmd);
+ #else
+ static void rewritelog_child(void *cmd);
+ #endif
static void rewritelog(request_rec *r, int level, const char *text, ...);
static char *current_logtime(request_rec *r);
/* program map support */
static void run_rewritemap_programs(server_rec *s, pool *p);
+ #if MODULE_MAGIC_NUMBER > 19970622
static int rewritemap_program_child(void *cmd);
+ #else
+ static void rewritemap_program_child(void *cmd);
+ #endif
/* env variable support */
static void expand_variables_inbuffer(request_rec *r, char *buf, int buf_len);