提交 2f620f29 编写于 作者: Q qicosmos

format code.

上级 e56bdacd
#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(); }
......
......@@ -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()) {
......
......@@ -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);
......
......@@ -2,6 +2,7 @@
#include "picohttpparser.h"
#include <cctype>
#include <string_view>
#include <vector>
using namespace std::string_view_literals;
......
......@@ -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
......
......@@ -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,
......
#pragma once
#include <cctype>
#include <string_view>
#include "utils.hpp"
namespace cinatra {
// most of this code is from cpprestsdk
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册