Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a8cb98c7
提交
a8cb98c7
authored
3月 19, 2013
作者:
Chris Rienzo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mod_http_cache: added http_cache file format that won't conflict with mod_httapi.
上级
2dc3b47d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
8 行删除
+15
-8
mod_http_cache.c
src/mod/applications/mod_http_cache/mod_http_cache.c
+15
-8
没有找到文件。
src/mod/applications/mod_http_cache/mod_http_cache.c
浏览文件 @
a8cb98c7
...
...
@@ -1172,15 +1172,13 @@ struct http_context {
/**
* Open URL
* @param handle
* @param prefix URL prefix
* @param path the URL
* @return SWITCH_STATUS_SUCCESS if opened
*/
static
switch_status_t
file_open
(
switch_file_handle_t
*
handle
,
const
char
*
prefix
,
const
char
*
path
)
static
switch_status_t
http_cache_file_open
(
switch_file_handle_t
*
handle
,
const
char
*
path
)
{
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
struct
http_context
*
context
=
switch_core_alloc
(
handle
->
memory_pool
,
sizeof
(
*
context
));
const
char
*
url
=
switch_core_sprintf
(
handle
->
memory_pool
,
"%s%s"
,
prefix
,
path
);
const
char
*
local_path
;
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_WRITE
))
{
...
...
@@ -1188,7 +1186,7 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *prefi
return
SWITCH_STATUS_FALSE
;
}
local_path
=
url_cache_get
(
&
gcache
,
NULL
,
url
,
1
,
handle
->
memory_pool
);
local_path
=
url_cache_get
(
&
gcache
,
NULL
,
path
,
1
,
handle
->
memory_pool
);
if
(
!
local_path
)
{
return
SWITCH_STATUS_FALSE
;
}
...
...
@@ -1198,7 +1196,7 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *prefi
handle
->
channels
,
handle
->
samplerate
,
SWITCH_FILE_FLAG_READ
|
SWITCH_FILE_DATA_SHORT
,
NULL
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to open HTTP cache file: %s, %s
\n
"
,
local_path
,
url
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to open HTTP cache file: %s, %s
\n
"
,
local_path
,
path
);
return
status
;
}
...
...
@@ -1229,7 +1227,7 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *prefi
*/
static
switch_status_t
http_file_open
(
switch_file_handle_t
*
handle
,
const
char
*
path
)
{
return
file_open
(
handle
,
"http://"
,
path
);
return
http_cache_file_open
(
handle
,
switch_core_sprintf
(
handle
->
memory_pool
,
"http://%s"
,
path
)
);
}
/**
...
...
@@ -1240,7 +1238,7 @@ static switch_status_t http_file_open(switch_file_handle_t *handle, const char *
*/
static
switch_status_t
https_file_open
(
switch_file_handle_t
*
handle
,
const
char
*
path
)
{
return
file_open
(
handle
,
"https://"
,
path
);
return
http_cache_file_open
(
handle
,
switch_core_sprintf
(
handle
->
memory_pool
,
"https://%s"
,
path
)
);
}
/**
...
...
@@ -1269,6 +1267,7 @@ static switch_status_t http_file_close(switch_file_handle_t *handle)
static
char
*
http_supported_formats
[]
=
{
"http"
,
NULL
};
static
char
*
https_supported_formats
[]
=
{
"https"
,
NULL
};
static
char
*
http_cache_supported_formats
[]
=
{
"http_cache"
,
NULL
};
/**
* Called when FreeSWITCH loads the module
...
...
@@ -1277,6 +1276,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load)
{
switch_api_interface_t
*
api
;
int
i
;
switch_file_interface_t
*
file_interface
;
*
module_interface
=
switch_loadable_module_create_module_interface
(
pool
,
modname
);
...
...
@@ -1293,8 +1293,15 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load)
return
SWITCH_STATUS_TERM
;
}
file_interface
=
switch_loadable_module_create_interface
(
*
module_interface
,
SWITCH_FILE_INTERFACE
);
file_interface
->
interface_name
=
modname
;
file_interface
->
extens
=
http_cache_supported_formats
;
file_interface
->
file_open
=
http_cache_file_open
;
file_interface
->
file_close
=
http_file_close
;
file_interface
->
file_read
=
http_file_read
;
if
(
gcache
.
enable_file_formats
)
{
switch_file_interface_t
*
file_interface
=
switch_loadable_module_create_interface
(
*
module_interface
,
SWITCH_FILE_INTERFACE
);
file_interface
=
switch_loadable_module_create_interface
(
*
module_interface
,
SWITCH_FILE_INTERFACE
);
file_interface
->
interface_name
=
modname
;
file_interface
->
extens
=
http_supported_formats
;
file_interface
->
file_open
=
http_file_open
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论