Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NetWork
Cinatra
提交
2f620f29
C
Cinatra
项目概览
NetWork
/
Cinatra
通知
5
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cinatra
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2f620f29
编写于
4月 18, 2021
作者:
Q
qicosmos
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format code.
上级
e56bdacd
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
24 addition
and
23 deletion
+24
-23
include/cinatra/client_factory.hpp
include/cinatra/client_factory.hpp
+0
-6
include/cinatra/connection.hpp
include/cinatra/connection.hpp
+8
-6
include/cinatra/http_client.hpp
include/cinatra/http_client.hpp
+1
-1
include/cinatra/http_parser.hpp
include/cinatra/http_parser.hpp
+1
-0
include/cinatra/modern_callback.h
include/cinatra/modern_callback.h
+11
-9
include/cinatra/multipart_reader.hpp
include/cinatra/multipart_reader.hpp
+1
-1
include/cinatra/uri.hpp
include/cinatra/uri.hpp
+1
-0
include/cinatra/utils.hpp
include/cinatra/utils.hpp
+1
-0
未找到文件。
include/cinatra/client_factory.hpp
浏览文件 @
2f620f29
#pragma once
#include "async_client.hpp"
#include "http_client.hpp"
namespace
cinatra
{
...
...
@@ -14,11 +13,6 @@ public:
return
std
::
make_shared
<
http_client
>
(
ios_
,
std
::
forward
<
Args
>
(
args
)...);
}
template
<
typename
...
Args
>
std
::
shared_ptr
<
async_client
>
new_async_client
(
Args
&&
...
args
)
{
return
std
::
make_shared
<
async_client
>
(
ios_
,
std
::
forward
<
Args
>
(
args
)...);
}
void
run
()
{
ios_
.
run
();
}
void
stop
()
{
ios_
.
stop
();
}
...
...
include/cinatra/connection.hpp
浏览文件 @
2f620f29
...
...
@@ -398,7 +398,7 @@ private:
// if (req_.get_method() ==
//"GET"&&http_cache::get().need_cache(req_.get_url())&&!http_cache::get().not_cache(req_.get_url()))
//{ handle_cache();
//return;
//
return;
// }
req_
.
set_last_len
(
len_
);
...
...
@@ -579,9 +579,11 @@ private:
// cache
// if (req_.get_method() ==
//"GET"&&http_cache::get().need_cache(req_.get_url()) &&
//!http_cache::get().not_cache(req_.get_url())) { auto raw_url =
//req_.raw_url(); http_cache::get().add(std::string(raw_url.data(),
//raw_url.length()), res_.raw_content());
//! http_cache::get().not_cache(req_.get_url())) {
//! auto raw_url =
// req_.raw_url();
// http_cache::get().add(std::string(raw_url.data(), raw_url.length()),
// res_.raw_content());
// }
boost
::
asio
::
async_write
(
...
...
@@ -1203,7 +1205,7 @@ private:
//-------------web socket----------------//
//-------------chunked(read chunked not support yet, write chunked is
//ok)----------------------//
//
ok)----------------------//
void
handle_chunked
(
size_t
bytes_transferred
)
{
int
ret
=
req_
.
parse_chunked
(
bytes_transferred
);
if
(
ret
==
parse_status
::
has_error
)
{
...
...
@@ -1221,7 +1223,7 @@ private:
call_back
();
// app set the data
}
//-------------chunked(read chunked not support yet, write chunked is
//ok)----------------------//
//
ok)----------------------//
void
handle_body
()
{
if
(
req_
.
at_capacity
())
{
...
...
include/cinatra/http_client.hpp
浏览文件 @
2f620f29
...
...
@@ -832,7 +832,7 @@ private:
return
;
}
if
(
additional_size
<
(
chunk_size
+
2
))
{
if
(
additional_size
<
size_t
(
chunk_size
+
2
))
{
// Not a complete chunk.
read_chunk_body
(
keep_alive
,
chunk_size
,
chunk_size
+
2
-
additional_size
);
...
...
include/cinatra/http_parser.hpp
浏览文件 @
2f620f29
...
...
@@ -2,6 +2,7 @@
#include "picohttpparser.h"
#include <cctype>
#include <string_view>
#include <vector>
using
namespace
std
::
string_view_literals
;
...
...
include/cinatra/modern_callback.h
浏览文件 @
2f620f29
...
...
@@ -18,16 +18,18 @@
//
// An asynchronous function that uses callbacks to process results will involve
// the following concepts: _Input_t...: Input parameters of asynchronous
//functions; _Signature_t: The function signature of this asynchronous callback;
//should meet the type of 'void (_Exception_t, _Result_t ...)' or 'void
// functions; _Signature_t: The function signature of this asynchronous
// callback; should meet the type of 'void (_Exception_t, _Result_t ...)' or
// 'void
//(_Result_t ...)’ _Callable_t: Callback function or mark, if it is a callback
//function, it needs to comply with the signature type of _Signature_t. This
//callback must be called once, and only once; _Return_t: The return value of
//the asynchronous function; _Result_t...: The result value after the completion
//of the asynchronous function is used as the input parameter of the callback
//function; this parameter can have zero or more; _Exception_t: The exception of
//the callback function, if you don't like the exception, ignore this part, but
//you have to handle the exception properly with the asynchronous code;
// function, it needs to comply with the signature type of _Signature_t. This
// callback must be called once, and only once; _Return_t: The return value of
// the asynchronous function; _Result_t...: The result value after the
// completion of the asynchronous function is used as the input parameter of the
// callback function; this parameter can have zero or more; _Exception_t: The
// exception of the callback function, if you don't like the exception, ignore
// this part, but you have to handle the exception properly with the asynchronous
// code;
//
// In the callback adapter model, The
// '_Input_t.../_Result_t/_Exception_t(Optional)' is an inherent part of the
...
...
include/cinatra/multipart_reader.hpp
浏览文件 @
2f620f29
...
...
@@ -93,7 +93,7 @@ private:
self
->
currentHeaderValue
.
clear
();
// self->currentHeaders.emplace(std::string{ self->currentHeaderName.data(),
// self->currentHeaderName.length() }, std::string{
//self->currentHeaderValue.data(), self->currentHeaderValue.length() });
//
self->currentHeaderValue.data(), self->currentHeaderValue.length() });
}
static
void
cbHeadersEnd
(
const
char
*
buffer
,
size_t
start
,
size_t
end
,
...
...
include/cinatra/uri.hpp
浏览文件 @
2f620f29
#pragma once
#include <cctype>
#include <string_view>
#include "utils.hpp"
namespace
cinatra
{
// most of this code is from cpprestsdk
...
...
include/cinatra/utils.hpp
浏览文件 @
2f620f29
...
...
@@ -18,6 +18,7 @@
#include <string>
#include <string_view>
#include <type_traits>
#include <boost/system/error_code.hpp>
namespace
cinatra
{
struct
ci_less
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录