From 029fdaeae68704d952cafa8e6fb2ab07edda588f Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 19 Dec 2018 17:53:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/config.cpp | 21 --------------------- src/Common/config.h | 6 ------ tests/test_httpApi.cpp | 16 ++++++++++++++++ 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/Common/config.cpp b/src/Common/config.cpp index 75d25dcb..e4af49b0 100644 --- a/src/Common/config.cpp +++ b/src/Common/config.cpp @@ -75,12 +75,6 @@ onceToken token([](){ namespace Http { #define HTTP_FIELD "http." -#define HTTP_PORT 80 -const char kPort[] = HTTP_FIELD"port"; - -#define HTTPS_PORT 443 -extern const char kSSLPort[] = HTTP_FIELD"sslport"; - //http 文件发送缓存大小 #define HTTP_SEND_BUF_SIZE (64 * 1024) const char kSendBufSize[] = HTTP_FIELD"sendBufSize"; @@ -123,8 +117,6 @@ const char kNotFound[] = HTTP_FIELD"notFound"; onceToken token([](){ - mINI::Instance()[kPort] = HTTP_PORT; - mINI::Instance()[kSSLPort] = HTTPS_PORT; mINI::Instance()[kSendBufSize] = HTTP_SEND_BUF_SIZE; mINI::Instance()[kMaxReqSize] = HTTP_MAX_REQ_SIZE; mINI::Instance()[kKeepAliveSecond] = HTTP_KEEP_ALIVE_SECOND; @@ -140,14 +132,10 @@ onceToken token([](){ namespace Shell { #define SHELL_FIELD "shell." -#define SHELL_PORT 9000 -const char kPort[] = SHELL_FIELD"port"; - #define SHELL_MAX_REQ_SIZE 1024 const char kMaxReqSize[] = SHELL_FIELD"maxReqSize"; onceToken token([](){ - mINI::Instance()[kPort] = SHELL_PORT; mINI::Instance()[kMaxReqSize] = SHELL_MAX_REQ_SIZE; },nullptr); } //namespace Shell @@ -155,14 +143,9 @@ onceToken token([](){ ////////////RTSP服务器配置/////////// namespace Rtsp { #define RTSP_FIELD "rtsp." - -#define RTSP_PORT 554 -const char kPort[] = RTSP_FIELD"port"; - const char kAuthBasic[] = RTSP_FIELD"authBasic"; onceToken token([](){ - mINI::Instance()[kPort] = RTSP_PORT; //默认Md5方式认证 mINI::Instance()[kAuthBasic] = 0; },nullptr); @@ -172,13 +155,9 @@ onceToken token([](){ ////////////RTMP服务器配置/////////// namespace Rtmp { #define RTMP_FIELD "rtmp." - -#define RTMP_PORT 1935 -const char kPort[] = RTMP_FIELD"port"; const char kModifyStamp[] = RTMP_FIELD"modifyStamp"; onceToken token([](){ - mINI::Instance()[kPort] = RTMP_PORT; mINI::Instance()[kModifyStamp] = true; },nullptr); } //namespace RTMP diff --git a/src/Common/config.h b/src/Common/config.h index 9c31a14c..e1841090 100644 --- a/src/Common/config.h +++ b/src/Common/config.h @@ -151,8 +151,6 @@ extern const char kBroadcastReloadConfig[]; ////////////HTTP配置/////////// namespace Http { -extern const char kPort[]; -extern const char kSSLPort[]; //http 文件发送缓存大小 extern const char kSendBufSize[]; //http 最大请求字节数 @@ -173,20 +171,16 @@ extern const char kNotFound[]; ////////////SHELL配置/////////// namespace Shell { extern const char kMaxReqSize[]; -extern const char kPort[]; } //namespace Shell ////////////RTSP服务器配置/////////// namespace Rtsp { - -extern const char kPort[]; //是否优先base64方式认证?默认Md5方式认证 extern const char kAuthBasic[]; } //namespace Rtsp ////////////RTMP服务器配置/////////// namespace Rtmp { -extern const char kPort[]; extern const char kModifyStamp[]; } //namespace RTMP diff --git a/tests/test_httpApi.cpp b/tests/test_httpApi.cpp index 057a508a..922be8ce 100644 --- a/tests/test_httpApi.cpp +++ b/tests/test_httpApi.cpp @@ -42,6 +42,22 @@ using namespace std; using namespace toolkit; using namespace mediakit; +namespace mediakit { +////////////HTTP配置/////////// +namespace Http { +#define HTTP_FIELD "http." +#define HTTP_PORT 80 +const char kPort[] = HTTP_FIELD"port"; +#define HTTPS_PORT 443 +extern const char kSSLPort[] = HTTP_FIELD"sslport"; +onceToken token1([](){ + mINI::Instance()[kPort] = HTTP_PORT; + mINI::Instance()[kSSLPort] = HTTPS_PORT; +},nullptr); +}//namespace Http +} // namespace mediakit + + static onceToken s_token([](){ NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastHttpRequest,[](BroadcastHttpRequestArgs){ //const Parser &parser,HttpSession::HttpResponseInvoker &invoker,bool &consumed