From 712d9010d7611259bb38161348e6d05ffe53fa48 Mon Sep 17 00:00:00 2001 From: yuqing Date: Fri, 26 May 2017 10:42:16 +0800 Subject: [PATCH] http.conf add parameter http.multi_range.enabed --- HISTORY | 3 ++- common/fdfs_http_shared.c | 11 ++++++++--- common/fdfs_http_shared.h | 3 +++ conf/http.conf | 3 +++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/HISTORY b/HISTORY index 5e43890..d3acfee 100644 --- a/HISTORY +++ b/HISTORY @@ -1,7 +1,8 @@ -Version 5.11 2017-05-25 +Version 5.11 2017-05-26 * bug fixed: file_offset has no effect when use trunk file * add storage access log header + * http.conf add parameter http.multi_range.enabed Version 5.10 2017-03-29 * use fc_safe_read instead of read, and fc_safe_write instead of write diff --git a/common/fdfs_http_shared.c b/common/fdfs_http_shared.c index 66a754b..f25ec17 100644 --- a/common/fdfs_http_shared.c +++ b/common/fdfs_http_shared.c @@ -124,6 +124,10 @@ int fdfs_http_params_load(IniContext *pIniContext, \ "http.need_find_content_type", \ pIniContext, true); + pParams->support_multi_range = iniGetBoolValue(NULL, \ + "http.multi_range.enabed", \ + pIniContext, true); + pParams->server_port = iniGetIntValue(NULL, "http.server_port", \ pIniContext, 80); if (pParams->server_port <= 0) @@ -137,7 +141,8 @@ int fdfs_http_params_load(IniContext *pIniContext, \ pParams->anti_steal_token = iniGetBoolValue(NULL, \ "http.anti_steal.check_token", \ pIniContext, false); - if (pParams->need_find_content_type || pParams->anti_steal_token) + if (pParams->need_find_content_type || pParams->anti_steal_token || + pParams->support_multi_range) { mime_types_filename = iniGetStrValue(NULL, "http.mime_types_filename", \ pIniContext); @@ -275,7 +280,7 @@ int fdfs_http_params_load(IniContext *pIniContext, \ return result; } - if (!pParams->need_find_content_type) + if (!(pParams->need_find_content_type || pParams->support_multi_range)) { hash_destroy(&pParams->content_type_hash); } @@ -294,7 +299,7 @@ int fdfs_http_params_load(IniContext *pIniContext, \ void fdfs_http_params_destroy(FDFSHTTPParams *pParams) { - if (pParams->need_find_content_type) + if (!(pParams->need_find_content_type || pParams->support_multi_range)) { hash_destroy(&pParams->content_type_hash); } diff --git a/common/fdfs_http_shared.h b/common/fdfs_http_shared.h index 14e111f..febd670 100644 --- a/common/fdfs_http_shared.h +++ b/common/fdfs_http_shared.h @@ -25,6 +25,9 @@ typedef struct /* if need find content type by file extension name */ bool need_find_content_type; + /* if support multi range */ + bool support_multi_range; + /* the web server port */ int server_port; diff --git a/conf/http.conf b/conf/http.conf index 6f643de..4d055f9 100644 --- a/conf/http.conf +++ b/conf/http.conf @@ -24,3 +24,6 @@ http.anti_steal.secret_key=FastDFS1234567890 # default value is empty (no file sepecified) http.anti_steal.token_check_fail=/home/yuqing/fastdfs/conf/anti-steal.jpg +# if support multi regions for HTTP Range +# default value is true +http.multi_range.enabed = true