2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_REQUEST_URI_H_
18 #define incl_HPHP_REQUEST_URI_H_
20 #include "hphp/runtime/base/type-string.h"
23 ///////////////////////////////////////////////////////////////////////////////
29 RequestURI(const VirtualHost
*vhost
, Transport
*transport
,
30 const std::string
&pathTranslation
,
31 const std::string
&sourceRoot
);
32 explicit RequestURI(const std::string
& rpcFunc
);
34 const String
& originalURL() const { return m_originalURL
; }
35 const String
& resolvedURL() const { return m_resolvedURL
; }
36 const String
& queryString() const { return m_queryString
; }
38 const String
& path() const { return m_path
; }
39 const char *ext() const { return m_ext
; }
40 const String
& absolutePath() const { return m_absolutePath
; }
41 const String
& pathInfo() const { return m_pathInfo
; }
42 const String
& origPathInfo() const { return m_origPathInfo
; }
44 bool rewritten() const { return m_rewritten
; }
45 bool defaultDoc() const { return m_defaultDoc
; }
46 bool done() const { return m_done
; }
47 bool forbidden() const { return m_forbidden
; }
52 static void splitURL(String url
, String
&base
, String
&query
);
54 String m_originalURL
; // without being rewritten, without query string
56 String m_rewrittenURL
; // possibly rewritten
57 String m_resolvedURL
; // possibly appended with default document and
61 String m_origPathInfo
;
62 String m_absolutePath
;
63 String m_path
; // path relative to SourceRoot
65 bool m_rewritten
; // whether rewrite rules have applied
66 bool m_defaultDoc
; // whether DefaultDocument was appended
69 const char *m_ext
; // file extension
71 bool process(const VirtualHost
*vhost
, Transport
*transport
,
72 const std::string
&pathTranslation
,
73 const std::string
&sourceRoot
, const char *url
);
74 bool rewriteURL(const VirtualHost
*vhost
, Transport
*transport
,
75 const std::string
&pathTranslation
,
76 const std::string
&sourceRoot
);
77 bool resolveURL(const VirtualHost
*vhost
,
78 const std::string
&pathTranslation
,
79 const std::string
&sourceRoot
);
80 bool virtualFileExists(const VirtualHost
*vhost
,
81 const std::string
&pathTranslation
,
82 const std::string
&sourceRoot
,
83 const String
& filename
);
84 bool virtualFolderExists(const VirtualHost
*vhost
,
85 const std::string
&pathTranslation
,
86 const std::string
&sourceRoot
,
87 const String
& foldername
);
90 std::vector
<std::string
> m_triedURLs
;
91 const std::string
getDefault404();
93 static const char *parseExt(const String
& s
);
94 static void PrependSlash(String
&s
);
98 ///////////////////////////////////////////////////////////////////////////////
101 #endif // incl_HPHP_REQUEST_URI_H_