hhvm icon indicating copy to clipboard operation
hhvm copied to clipboard

Only one DefaultDocument

Open chrisgraham opened this issue 16 years ago • 5 comments

It's fairly normal to use index.php in some directories and e.g. index.htm in others. However it seems HPHP only allows one DefaultDocument. I think this is a problem.

chrisgraham avatar Jul 26 '10 09:07 chrisgraham

Further DefaultDocument is only valid on the root, not subdirectories, where DefaultDocument is completely ignored.

joelastpass avatar Jul 29 '11 18:07 joelastpass

I had the same problem for subdirectiories and made a patch, this will allow the use of DefaultDocument on subdirectories.

diff --git a/src/runtime/base/server/request_uri.cpp b/src/runtime/base/server/request_uri.cpp
index 49177e3..d3f43ab 100644
--- a/src/runtime/base/server/request_uri.cpp
+++ b/src/runtime/base/server/request_uri.cpp
@@ -204,8 +204,10 @@ bool RequestURI::virtualFileExists(const VirtualHost *vhost,
                                    const string &sourceRoot,
                                    const string &pathTranslation,
                                    CStrRef filename) {
-  if (filename.empty() || filename.charAt(filename.length() - 1) == '/') {
+  if (filename.empty())
     return false;
+  if (filename.charAt(filename.length() - 1) == '/' && RuntimeOption::DefaultDocument.size()) {
+    return virtualFileExists(vhost, sourceRoot, pathTranslation, String(filename.data() + RuntimeOption::DefaultDocument));
   }
   if (!vhost->getDocumentRoot().empty()) {
     string fullname = filename.data();

fungos avatar Oct 05 '11 17:10 fungos

fungos: thanks for your patch, we're waiting for this feature in official source tree too... :) see less: http://groups.google.com/group/hiphop-php-dev/browse_thread/thread/75fbfc70ea884218

louisehu avatar Nov 01 '11 16:11 louisehu

@louisehu: You're welcome. I'm using this patch with success for some time.

fungos avatar Nov 06 '11 13:11 fungos

We're closing out all bugs older than 2 months. http://www.hiphop-php.com/wp/?p=575

If this is still an issue, please re-open it, and in order of goodness:

  1. Give detailed repro steps
  2. Write a test case in hphp/tests/quick (run it with hphp/tests/run) and send the pull request
  3. Fix it in a pull request

ptarjan avatar May 13 '13 22:05 ptarjan