Permalink
Browse files

Fixed some mod_rewrite compatibility problems. Fixes issue #563.

  • Loading branch information...
1 parent 538c2e5 commit 6fbbe01f84f5c0c357d96d681020a7109bad762b @FooBarWidget FooBarWidget committed Jul 18, 2012
Showing with 35 additions and 3 deletions.
  1. +10 −0 NEWS
  2. +25 −3 ext/apache2/Hooks.cpp
View
10 NEWS
@@ -1,3 +1,13 @@
+Release 3.0.14
+--------------
+
+ * [Apache] Fixed a long-standing mod_rewrite-related problem.
+ Some mod_rewrite rules would not work, but it depends on the exact
+ mod_rewrite configuration so it would work for some people but not
+ for others. Issue #563. Thanks a lot to cedricmaion for providing
+ information on the nature of the bug.
+
+
Release 3.0.13
--------------
View
@@ -159,6 +159,7 @@ class Hooks {
char *filenameBeforeModRewrite;
apr_filetype_e oldFileType;
const char *handlerBeforeModAutoIndex;
+ bool enabled;
RequestNote(const DirectoryMapper &m, DirConfig *c)
: mapper(m),
@@ -169,6 +170,7 @@ class Hooks {
filenameBeforeModRewrite = NULL;
oldFileType = APR_NOFILE;
handlerBeforeModAutoIndex = NULL;
+ enabled = true;
}
~RequestNote() {
@@ -239,9 +241,25 @@ class Hooks {
* The existance of a request note means that the handler should be run.
*/
inline RequestNote *getRequestNote(request_rec *r) {
- void *note = 0;
- apr_pool_userdata_get(&note, "Phusion Passenger", r->pool);
- return (RequestNote *) note;
+ void *pointer = 0;
+ apr_pool_userdata_get(&pointer, "Phusion Passenger", r->pool);
+ if (pointer != NULL) {
+ RequestNote *note = (RequestNote *) pointer;
+ if (OXT_LIKELY(note->enabled)) {
+ return note;
+ } else {
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+ }
+
+ void disableRequestNote(request_rec *r) {
+ RequestNote *note = getRequestNote(r);
+ if (note != NULL) {
+ note->enabled = false;
+ }
}
/**
@@ -418,6 +436,7 @@ class Hooks {
try {
if (mapper.getBaseURI() == NULL) {
// (B) is not true.
+ disableRequestNote(r);
return false;
}
} catch (const FileSystemException &e) {
@@ -441,6 +460,7 @@ class Hooks {
RequestNote::cleanup, r->pool);
return true;
} else {
+ disableRequestNote(r);
return false;
}
}
@@ -451,6 +471,7 @@ class Hooks {
FileType fileType = getFileType(filename);
if (fileType == FT_REGULAR) {
// (C) is true.
+ disableRequestNote(r);
return false;
}
@@ -511,6 +532,7 @@ class Hooks {
* don't let the handler hook run so that Apache can decide how
* to display the error.
*/
+ disableRequestNote(r);
return false;
}
}

0 comments on commit 6fbbe01

Please sign in to comment.