You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Roy Fielding <fi...@hyperreal.com> on 1997/03/07 13:00:35 UTC
cvs commit: apache/src CHANGES http_protocol.c mod_rewrite.c
fielding 97/03/07 04:00:34
Modified: src CHANGES http_protocol.c mod_rewrite.c
Log:
Fixed user and server confusion over what should be a virtual host
and what is the main server, resulting in access to something
other than the name defined in the virtualhost directive (but
with the same IP address) failing. Also updated mod_rewrite to
version 3.0.0.
Submitted by: Dean Gaudet and Ralf S. Engelschall
Reviewed by: Roy Fielding, Chuck Murcko
Revision Changes Path
1.184 +6 -0 apache/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache/src/CHANGES,v
retrieving revision 1.183
retrieving revision 1.184
diff -C3 -r1.183 -r1.184
*** CHANGES 1997/03/04 21:44:37 1.183
--- CHANGES 1997/03/07 12:00:30 1.184
***************
*** 1,5 ****
--- 1,11 ----
Changes with Apache 1.2b8
+ *) Fixed user and server confusion over what should be a virtual host
+ and what is the main server, resulting in access to something
+ other than the name defined in the virtualhost directive (but
+ with the same IP address) failing. Also updated mod_rewrite to
+ version 3.0.0. [Dean Gaudet and Ralf S. Engelschall]
+
*) bpushfd() no longer notes cleanups for the file descriptors it is handed.
Module authors may need to adjust their code for proper cleanup to take
place (that is, call note_cleanups_for_fd()). This change fixes problems
1.106 +24 -10 apache/src/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_protocol.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -C3 -r1.105 -r1.106
*** http_protocol.c 1997/02/22 00:37:18 1.105
--- http_protocol.c 1997/03/07 12:00:31 1.106
***************
*** 650,657 ****
r->hostname = host;
for (s = r->server->next; s; s = s->next) {
! const char *names = s->names;
!
if ((!strcasecmp(host, s->server_hostname)) && (port == s->port)) {
r->server = r->connection->server = s;
if (r->hostlen && !strncmp(r->uri, "http://", 7)) {
--- 650,658 ----
r->hostname = host;
for (s = r->server->next; s; s = s->next) {
! const char *names;
! server_addr_rec *sar;
!
if ((!strcasecmp(host, s->server_hostname)) && (port == s->port)) {
r->server = r->connection->server = s;
if (r->hostlen && !strncmp(r->uri, "http://", 7)) {
***************
*** 660,676 ****
}
}
! if (!names) continue;
!
! while (*names) {
! char *name = getword_conf (r->pool, &names);
!
! if ((is_matchexp(name) && !strcasecmp_match(host, name)) ||
! (!strcasecmp(host, name))) {
r->server = r->connection->server = s;
! if (r->hostlen && !strncmp(r->uri, "http://", 7)) {
r->uri += r->hostlen;
r->proxyreq = 0;
}
}
}
--- 661,690 ----
}
}
! /* search all the names from <VirtualHost> directive */
! for( sar = s->addrs; sar; sar = sar->next ) {
! if( !strcasecmp( sar->virthost, host ) ) {
r->server = r->connection->server = s;
! if( r->hostlen && !strncmp( r->uri, "http://", 7) ) {
r->uri += r->hostlen;
r->proxyreq = 0;
+ }
+ }
+ }
+
+ /* search all the aliases from ServerAlias directive */
+ names = s->names;
+ if( names ) {
+ while (*names) {
+ char *name = getword_conf (r->pool, &names);
+
+ if ((is_matchexp(name) && !strcasecmp_match(host, name)) ||
+ (!strcasecmp(host, name))) {
+ r->server = r->connection->server = s;
+ if (r->hostlen && !strncmp(r->uri, "http://", 7)) {
+ r->uri += r->hostlen;
+ r->proxyreq = 0;
+ }
}
}
}
1.21 +22 -22 apache/src/mod_rewrite.c
Index: mod_rewrite.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C3 -r1.20 -r1.21
*** mod_rewrite.c 1997/02/26 01:01:12 1.20
--- mod_rewrite.c 1997/03/07 12:00:31 1.21
***************
*** 61,67 ****
** |_| |_| |_|\___/ \__,_|___|_| \___| \_/\_/ |_| |_|\__\___|
** |_____|
**
! ** URL Rewriting Module, Version 3.0.0 (01-02-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.0 (06-Mar-1997)
**
** This module uses a rule-based rewriting engine (based on a
** regular-expression parser) to rewrite requested URLs on the fly.
***************
*** 98,105 ****
#include <time.h>
#include <signal.h>
#include <errno.h>
- #include <pwd.h>
- #include <grp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <netinet/in.h>
--- 98,103 ----
***************
*** 135,141 ****
** o Runtime logic of a request is as following:
**
** while(request or subrequest) {
! ** foreach(stage #1...#8) {
** foreach(module) { (**)
** try to run hook
** }
--- 133,139 ----
** o Runtime logic of a request is as following:
**
** while(request or subrequest) {
! ** foreach(stage #1...#9) {
** foreach(module) { (**)
** try to run hook
** }
***************
*** 149,160 ****
**
** o there are two different types of result checking and
** continue processing:
! ** for hook #1,#3,#4,#5,#7:
** hook run loop stops on first modules which gives
** back a result != DECLINED, i.e. it usually returns OK
** which says "OK, module has handled this _stage_" and for #1
** this have not to mean "Ok, the filename is now valid".
! ** for hook #2,#6,#8:
** all hooks are run, independend of result
**
** o at the last stage, the core module allways
--- 147,158 ----
**
** o there are two different types of result checking and
** continue processing:
! ** for hook #1,#4,#5,#6,#8:
** hook run loop stops on first modules which gives
** back a result != DECLINED, i.e. it usually returns OK
** which says "OK, module has handled this _stage_" and for #1
** this have not to mean "Ok, the filename is now valid".
! ** for hook #2,#3,#7,#9:
** all hooks are run, independend of result
**
** o at the last stage, the core module allways
***************
*** 205,222 ****
config_server_merge, /* merge per-server config structures */
command_table, /* table of config file commands */
! handler_table, /* [#7] table of MIME-typed-dispatched request action handlers */
hook_uri2file, /* [#1] URI to filename translation */
! NULL, /* [#3] check_user_id: get and validate user id from the HTTP request */
! NULL, /* [#4] check_auth: check if the user is ok _here_ */
NULL, /* [#2] check_access: check access by host address, etc. */
! hook_mimetype, /* [#5] determine MIME type */
! hook_fixup, /* [#6] pre-run fixups */
! NULL /* [#8] log a transaction */
};
/* the cache */
--- 203,221 ----
config_server_merge, /* merge per-server config structures */
command_table, /* table of config file commands */
! handler_table, /* [#8] table of MIME-typed-dispatched request action handlers */
hook_uri2file, /* [#1] URI to filename translation */
! NULL, /* [#4] check_user_id: get and validate user id from the HTTP request */
! NULL, /* [#5] check_auth: check if the user is ok _here_ */
NULL, /* [#2] check_access: check access by host address, etc. */
! hook_mimetype, /* [#6] determine MIME type */
! hook_fixup, /* [#7] pre-run fixups */
! NULL, /* [#9] log a transaction */
! NULL /* [#3] header parser */
};
/* the cache */
***************
*** 226,232 ****
static int proxy_available;
/* the txt mapfile parsing stuff */
! #define MAPFILE_PATTERN "^([^ ]+) +([^ ]+).*$"
#define MAPFILE_OUTPUT "$1,$2"
static regex_t *lookup_map_txtfile_regexp = NULL;
static regmatch_t lookup_map_txtfile_regmatch[10];
--- 225,231 ----
static int proxy_available;
/* the txt mapfile parsing stuff */
! #define MAPFILE_PATTERN "^([^ \t]+)[ \t]+([^ \t]+).*$"
#define MAPFILE_OUTPUT "$1,$2"
static regex_t *lookup_map_txtfile_regexp = NULL;
static regmatch_t lookup_map_txtfile_regmatch[10];
***************
*** 1123,1131 ****
* only do something under runtime if the engine is really enabled,
* for this directory, else return immediately!
*/
! if (!(allow_options(r) & OPT_SYM_LINKS)) {
/* FollowSymLinks is mandatory! */
! log_reason("Options FollowSymLinks is off which implies that RewriteRule directive is forbidden", r->filename, r);
return FORBIDDEN;
}
else {
--- 1122,1130 ----
* only do something under runtime if the engine is really enabled,
* for this directory, else return immediately!
*/
! if (!(allow_options(r) & (OPT_SYM_LINKS | OPT_SYM_OWNER))) {
/* FollowSymLinks is mandatory! */
! log_reason("Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden", r->filename, r);
return FORBIDDEN;
}
else {
***************
*** 3028,3033 ****
--- 3027,3033 ----
const char *names;
char *name;
int i, j;
+ server_addr_rec *sar;
/* we can check:
r->
***************
*** 3042,3054 ****
char *path name of ServerPath
int pathlen len of ServerPath
char *names Wildcarded names for ServerAlias servers
! under 1.1:
! r->server->
! struct in_addr host_addr The bound address, for this server
! short host_port The bound port, for this server
! char *virthost The name given in <VirtualHost>
! under 1.2:
! r->server->addrs->next...
struct in_addr host_addr The bound address, for this server
short host_port The bound port, for this server
char *virthost The name given in <VirtualHost>
--- 3042,3048 ----
char *path name of ServerPath
int pathlen len of ServerPath
char *names Wildcarded names for ServerAlias servers
! r->server->addrs->
struct in_addr host_addr The bound address, for this server
short host_port The bound port, for this server
char *virthost The name given in <VirtualHost>
***************
*** 3081,3086 ****
--- 3075,3086 ----
}
else if (r->server->is_virtual) {
/* virtual servers */
+
+ /* check for the names supplied in the VirtualHost directive */
+ for(sar = r->server->addrs; sar != NULL; sar = sar->next) {
+ if(strcasecmp(sar->virthost, testhost) == 0)
+ return YES;
+ }
/* check for the virtual-server aliases */
if (r->server->names != NULL && r->server->names[0] != '\0') {