• 大小: 22KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-27
  • 语言: 其他
  • 标签: nginx  

资源简介

fastdfs-nginx-module-master

资源截图

代码片段和文件信息

/**
* Copyright (C) 2008 Happy Fish / YuQing
*
* FastDFS may be copied only under the terms of the GNU General
* Public License V3 which may be found in the FastDFS source kit.
* Please visit the FastDFS Home Page http://www.csource.org/ for more detail.
**/


#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include “fdfs_define.h“
#include “logger.h“
#include “shared_func.h“
#include “fdfs_global.h“
#include “sockopt.h“
#include “http_func.h“
#include “fdfs_http_shared.h“
#include “fdfs_client.h“
#include “local_ip_func.h“
#include “fdfs_shared_func.h“
#include “trunk_shared.h“
#include “common.h“

#define FDFS_MOD_REPONSE_MODE_PROXY ‘P‘
#define FDFS_MOD_REPONSE_MODE_REDIRECT ‘R‘


#define FDFS_CONTENT_TYPE_TAG_STR   “Content-type: “
#define FDFS_CONTENT_TYPE_TAG_LEN   (sizeof(FDFS_CONTENT_TYPE_TAG_STR) - 1)
#define FDFS_CONTENT_RANGE_TAG_STR  “Content-range: “
#define FDFS_CONTENT_RANGE_TAG_LEN  (sizeof(FDFS_CONTENT_RANGE_TAG_STR) - 1)

static char  flv_header[] = “FLV\x1\x1\0\0\0\x9\0\0\0\x9“;

#define FDFS_RANGE_LENGTH(range) ((range.end - range.start) + 1)

typedef struct tagGroupStorePaths {
char group_name[FDFS_GROUP_NAME_MAX_LEN + 1];
int group_name_len;
int storage_server_port;
FDFSStorePaths store_paths;
} GroupStorePaths;

static int storage_server_port = FDFS_STORAGE_SERVER_DEF_PORT;
static int my_group_name_len = 0;
static int group_count = 0;  //for multi groups
static bool url_have_group_name = false;
static bool use_storage_id = false;
static bool flv_support = false;  //if support flv
static char flv_extension[FDFS_FILE_EXT_NAME_MAX_LEN + 1] = {0};  //flv extension name
static int  flv_ext_len = 0;  //flv extension length
static char my_group_name[FDFS_GROUP_NAME_MAX_LEN + 1] = {0};
static char response_mode = FDFS_MOD_REPONSE_MODE_PROXY;
static GroupStorePaths *group_store_paths = NULL;   //for multi groups
static FDFSHTTPParams g_http_params;
static int storage_sync_file_max_delay = 24 * 3600;

static int fdfs_get_params_from_tracker();
static int fdfs_format_http_datetime(time_t t char *buff const int buff_size);

static int fdfs_strtoll(const char *s int64_t *value)
{
char *end = NULL;
*value = strtoll(s &end 10);
if (end != NULL && *end != ‘\0‘)
{
return EINVAL;
}

return 0;
}

static int fdfs_load_groups_store_paths(IniContext *pItemContext)
{
char section_name[64];
char *pGroupName;
int bytes;
int result;
int i;

bytes = sizeof(GroupStorePaths) * group_count;
group_store_paths = (GroupStorePaths *)malloc(bytes);
if (group_store_paths == NULL)
{
logError(“file: “__FILE__“ line: %d “ \
“malloc %d bytes fail “ \
“errno: %d error info: %s“ \
__LINE__ bytes errno STRERROR(errno));
return errno != 0 ? errno : ENOMEM;
}

for (i=0; i {
sprintf(section_name “group%d“ i + 1);
pGro

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-05-30 01:57  fastdfs-nginx-module-master\
     文件        2804  2017-05-30 01:57  fastdfs-nginx-module-master\HISTORY
     文件        1722  2017-05-30 01:57  fastdfs-nginx-module-master\INSTALL
     目录           0  2017-05-30 01:57  fastdfs-nginx-module-master\src\
     文件       43398  2017-05-30 01:57  fastdfs-nginx-module-master\src\common.c
     文件        3987  2017-05-30 01:57  fastdfs-nginx-module-master\src\common.h
     文件         902  2017-05-30 01:57  fastdfs-nginx-module-master\src\config
     文件        3725  2017-05-30 01:57  fastdfs-nginx-module-master\src\mod_fastdfs.conf
     文件       28668  2017-05-30 01:57  fastdfs-nginx-module-master\src\ngx_http_fastdfs_module.c

评论

共有 条评论