檢視原始碼 mod_alias (inets v9.3.1)
URL 別名。
Erlang 網頁伺服器內部 API,用於處理例如由模組 mod_alias
匯出的互動資料。
摘要
函式
如果 Path
是一個目錄,default_index/2
會開始搜尋在設定指令 DirectoryIndex
中指定的資源或檔案。如果找到適當的資源或檔案,它會附加到 Path
的末尾,然後返回。Path
如果沒有找到適當的檔案,或者 Path
不是目錄,則會原封不動地返回。config_db()
是 ETS 表格格式的伺服器設定檔,如 Inets 使用者指南中所述。
path/3
會在 RequestURI
中返回檔案 Path
(請參閱 RFC 1945)。如果互動資料 {real_name, {Path, AfterPath}}
已由 mod_alias
匯出,則返回 Path
。如果沒有匯出任何互動資料,則會使用 ServerRoot
來產生檔案 Path
。config_db()
和 interaction_data()
的定義與 Inets 使用者指南中相同。
real_name/3
會遍歷 Aliases
(通常從 ConfigDB
中提取),並將每個 FakeName
與 RequestURI
比對。如果找到相符項,則會將相符項中的 FakeName
替換為 RealName
。產生的路徑會分成兩個部分,ShortPath
和 AfterPath
,如 httpd_util:split_path/1
中所定義。Path
是從 ShortPath
產生,也就是使用 ShortPath
作為引數的 default_index/2
的結果。config_db()
是 ETS 表格格式的伺服器設定檔,如 Inets 使用者指南中所述。
real_script_name/3
會遍歷 ScriptAliases
(通常從 ConfigDB
中提取),並將每個 FakeName
與 RequestURI
比對。如果找到相符項,則會將相符項中的 FakeName
替換為 RealName
。如果產生的相符項不是可執行腳本,則會返回 not_a_script
。如果它是腳本,則產生的腳本路徑會分為兩個部分,ShortPath
和 AfterPath
,如 httpd_util:split_script_path/1
中所定義。config_db()
是 ETS 表格格式的伺服器設定檔,如 Inets 使用者指南中所述。
函式
-spec default_index(ConfigDB, Path) -> NewPath when ConfigDB :: ets:tid(), Path :: string(), NewPath :: string().
如果 Path
是一個目錄,default_index/2
會開始搜尋在設定指令 DirectoryIndex
中指定的資源或檔案。如果找到適當的資源或檔案,它會附加到 Path
的末尾,然後返回。Path
如果沒有找到適當的檔案,或者 Path
不是目錄,則會原封不動地返回。config_db()
是 ETS 表格格式的伺服器設定檔,如 Inets 使用者指南中所述。
-spec path(Data, ConfigDB, RequestURI) -> Path when Data :: [{real_name, {Path, AfterPath}}], ConfigDB :: ets:tid(), RequestURI :: string(), AfterPath :: string(), Path :: string().
path/3
會在 RequestURI
中返回檔案 Path
(請參閱 RFC 1945)。如果互動資料 {real_name, {Path, AfterPath}}
已由 mod_alias
匯出,則返回 Path
。如果沒有匯出任何互動資料,則會使用 ServerRoot
來產生檔案 Path
。config_db()
和 interaction_data()
的定義與 Inets 使用者指南中相同。
-spec real_name(ConfigDB, RequestURI, Aliases) -> ReturnPath when ConfigDB :: ets:tid(), RequestURI :: string(), Aliases :: [{FakeName, RealName}], ReturnPath :: {ShortPath, Path, AfterPath}, FakeName :: re:mp() | iodata() | unicode:charlist() | string(), RealName :: string(), ShortPath :: string(), Path :: string(), AfterPath :: string().
real_name/3
會遍歷 Aliases
(通常從 ConfigDB
中提取),並將每個 FakeName
與 RequestURI
比對。如果找到相符項,則會將相符項中的 FakeName
替換為 RealName
。產生的路徑會分成兩個部分,ShortPath
和 AfterPath
,如 httpd_util:split_path/1
中所定義。Path
是從 ShortPath
產生,也就是使用 ShortPath
作為引數的 default_index/2
的結果。config_db()
是 ETS 表格格式的伺服器設定檔,如 Inets 使用者指南中所述。
-spec real_script_name(ConfigDB, RequestURI, ScriptAliases) -> ReturnPath | not_a_script when ConfigDB :: ets:tid(), RequestURI :: string(), ScriptAliases :: list() | [{FakeName, RealName}], ReturnPath :: {ShortPath, AfterPath}, FakeName :: re:mp() | iodata() | unicode:charlist() | string(), RealName :: string(), ShortPath :: string(), AfterPath :: term().
real_script_name/3
會遍歷 ScriptAliases
(通常從 ConfigDB
中提取),並將每個 FakeName
與 RequestURI
比對。如果找到相符項,則會將相符項中的 FakeName
替換為 RealName
。如果產生的相符項不是可執行腳本,則會返回 not_a_script
。如果它是腳本,則產生的腳本路徑會分為兩個部分,ShortPath
和 AfterPath
,如 httpd_util:split_script_path/1
中所定義。config_db()
是 ETS 表格格式的伺服器設定檔,如 Inets 使用者指南中所述。