Changes with Apache 1.3.24
+ *) 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]
+
*) apxs: fix bug that prevented -S option from containing quotes.
[Ben Laurie]
#include "httpd.h"
#include "http_config.h"
+#include "http_log.h"
typedef struct {
char *real;
/* 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))
- ap_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, r,
+ "cannot redirect '%s' to '%s'; "
+ "target is not a valid absoluteURI",
+ r->uri, ret);
+ }
+ else {
+ ap_table_setn(r->headers_out, "Location", ret);
+ }
+ }
return status;
}