You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2002/01/31 19:44:49 UTC
cvs commit: httpd-2.0/modules/mappers mod_alias.c
coar 02/01/31 10:44:48
Modified: . CHANGES
modules/mappers mod_alias.c
Log:
Fix RedirectMatch so it won't emit invalid Location fields.
Revision Changes Path
1.553 +6 -0 httpd-2.0/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-2.0/CHANGES,v
retrieving revision 1.552
retrieving revision 1.553
diff -u -u -r1.552 -r1.553
--- CHANGES 31 Jan 2002 05:31:39 -0000 1.552
+++ CHANGES 31 Jan 2002 18:44:48 -0000 1.553
@@ -1,5 +1,11 @@
Changes with Apache 2.0.32-dev
+ *) The Location: response header field, used for external
+ redirect, *must* be an absoluteURI. The Redirect directive
+ tested for that, but RedirectMatch didn't -- it would allow
+ almost anything through. Now it, too, will correctly varf
+ if the redirection target isn't an absoluteURI. [Ken Coar]
+
Changes with Apache 2.0.31
*) Add a timeout option to the proxy code 'ProxyTimeout'
1.34 +13 -2 httpd-2.0/modules/mappers/mod_alias.c
Index: mod_alias.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_alias.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -u -r1.33 -r1.34
--- mod_alias.c 22 Nov 2001 21:19:02 -0000 1.33
+++ mod_alias.c 31 Jan 2002 18:44:48 -0000 1.34
@@ -74,6 +74,7 @@
#include "httpd.h"
#include "http_config.h"
#include "http_request.h"
+#include "http_log.h"
typedef struct {
@@ -433,8 +434,18 @@
/* It may have changed since last time, so try again */
if ((ret = try_alias_list(r, dirconf->redirects, 1, &status)) != NULL) {
- if (ap_is_HTTP_REDIRECT(status))
- apr_table_setn(r->headers_out, "Location", ret);
+ if (ap_is_HTTP_REDIRECT(status)) {
+ if (!ap_is_url(ret)) {
+ status = HTTP_INTERNAL_SERVER_ERROR;
+ ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, r,
+ "cannot redirect '%s' to '%s'; "
+ "target is not a valid absoluteURI",
+ r->uri, ret);
+ }
+ else {
+ apr_table_setn(r->headers_out, "Location", ret);
+ }
+ }
return status;
}