Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
7ed5b7c2
Commit
7ed5b7c2
authored
Oct 28, 2019
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http api服务器支持发送大文件
parent
7c16f37d
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
28 行增加
和
9 行删除
+28
-9
src/Http/HttpBody.h
+2
-2
src/Http/HttpSession.cpp
+0
-0
src/Http/HttpSession.h
+26
-7
没有找到文件。
src/Http/HttpBody.h
查看文件 @
7ed5b7c2
...
...
@@ -54,14 +54,14 @@ public:
/**
* 剩余数据大小
*/
virtual
uint64_t
remainSize
()
=
0
;
virtual
uint64_t
remainSize
()
{
return
0
;}
;
/**
* 读取一定字节数,返回大小可能小于size
* @param size 请求大小
* @return 字节对象
*/
virtual
Buffer
::
Ptr
readData
(
uint32_t
size
)
=
0
;
virtual
Buffer
::
Ptr
readData
(
uint32_t
size
)
{
return
nullptr
;}
;
};
/**
...
...
src/Http/HttpSession.cpp
查看文件 @
7ed5b7c2
差异被折叠。
点击展开。
src/Http/HttpSession.h
查看文件 @
7ed5b7c2
...
...
@@ -36,21 +36,43 @@
#include "HttpRequestSplitter.h"
#include "WebSocketSplitter.h"
#include "HttpCookieManager.h"
#include "HttpBody.h"
#include "Util/function_traits.h"
using
namespace
std
;
using
namespace
toolkit
;
namespace
mediakit
{
/**
* 该类实现与老代码的兼容适配
*/
class
HttpResponseInvokerImp
{
public
:
typedef
std
::
function
<
void
(
const
string
&
codeOut
,
const
StrCaseMap
&
headerOut
,
const
HttpBody
::
Ptr
&
body
)
>
HttpResponseInvokerLambda0
;
typedef
std
::
function
<
void
(
const
string
&
codeOut
,
const
StrCaseMap
&
headerOut
,
const
string
&
body
)
>
HttpResponseInvokerLambda1
;
HttpResponseInvokerImp
(){}
~
HttpResponseInvokerImp
(){}
template
<
typename
C
>
HttpResponseInvokerImp
(
const
C
&
c
)
:
HttpResponseInvokerImp
(
typename
function_traits
<
C
>::
stl_function_type
(
c
))
{}
HttpResponseInvokerImp
(
const
HttpResponseInvokerLambda0
&
lambda
);
HttpResponseInvokerImp
(
const
HttpResponseInvokerLambda1
&
lambda
);
void
operator
()(
const
string
&
codeOut
,
const
StrCaseMap
&
headerOut
,
const
HttpBody
::
Ptr
&
body
)
const
;
void
operator
()(
const
string
&
codeOut
,
const
StrCaseMap
&
headerOut
,
const
string
&
body
)
const
;
operator
bool
();
private
:
HttpResponseInvokerLambda0
_lambad
;
};
class
HttpSession
:
public
TcpSession
,
public
FlvMuxer
,
public
HttpRequestSplitter
,
public
WebSocketSplitter
{
public
:
typedef
StrCaseMap
KeyValue
;
typedef
std
::
function
<
void
(
const
string
&
codeOut
,
const
KeyValue
&
headerOut
,
const
string
&
contentOut
)
>
HttpResponseInvoker
;
typedef
HttpResponseInvokerImp
HttpResponseInvoker
;
/**
* @param errMsg 如果为空,则代表鉴权通过,否则为错误提示
...
...
@@ -119,11 +141,8 @@ private:
void
urlDecode
(
Parser
&
parser
);
void
sendNotFound
(
bool
bClose
);
void
sendResponse
(
const
char
*
pcStatus
,
const
KeyValue
&
header
,
const
string
&
strContent
);
void
sendResponse
(
const
char
*
pcStatus
,
const
KeyValue
&
header
,
const
HttpBody
::
Ptr
&
body
,
bool
bClose
);
KeyValue
makeHttpHeader
(
bool
bClose
=
false
,
int64_t
iContentSize
=-
1
,
const
char
*
pcContentType
=
"text/html"
);
void
responseDelay
(
bool
bClose
,
const
string
&
codeOut
,
const
KeyValue
&
headerOut
,
const
string
&
contentOut
);
/**
* 判断http客户端是否有权限访问文件的逻辑步骤
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论