nqf

Results 71 comments of nqf

不要定义成全局 cclient_ ``` #include int main() { std::thread t([]() { drogon::app().disableSigtermHandling(); drogon::app().run(); }); t.detach(); sleep(1); auto cclient_ = drogon::HttpClient::newHttpClient("https://fapi.binance.com"); while (true) { auto req = drogon::HttpRequest::newHttpRequest(); req->setMethod(drogon::HttpMethod::Get); req->setContentTypeString("application/json"); const auto&...

> the HTTP client processes on will deadlock the event loop 你可以定义成全局, 但是你要保证 drogon::app().run(); 那个线程先被执行, 至于原理你看看 run 那个函数, 创建 drogon::HttpClient::newHttpClient对象时候, 如果你不传递Loop, 它就会用这个 Loop 单例 , 这个 loop 单例 默认 main...

json 嵌套深吗? ``` void HttpResponseImpl::parseJson() const { static std::once_flag once; static Json::CharReaderBuilder builder; std::call_once(once, []() { builder["collectComments"] = false; builder["stackLimit"] = static_cast(drogon::app().getJsonParserStackLimit()); }); ``` ![image](https://github.com/drogonframework/drogon/assets/29970876/80226917-6544-4072-b40a-fd4f60c3aa7e)

> > json 嵌套深吗? > > ``` > > void HttpResponseImpl::parseJson() const > > { > > static std::once_flag once; > > static Json::CharReaderBuilder builder; > > std::call_once(once, []() {...

> stackLimit 对的, bodyPtr_->getString() 这个东西 打出来看看是什么

@an-tao [ resp->parseJson();](https://github.com/drogonframework/drogon/blob/a2f759e4cd9d40a772a0f3006430d867c72e8f28/lib/src/HttpClientImpl.cc#L566) 可以在这添加一个开关来关闭它吗, 每次响应它都会自动解析 json, 这对于不需要使用getJsonObject()的用户似乎是不必要的开销

Did I use it wrong? ``` export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt auto client = HttpClient::newHttpClient("https://www.google.com"); auto req = HttpRequest::newHttpRequest(); client->sendRequest( req, [](ReqResult result, const HttpResponsePtr& response) { if (result != ReqResult::Ok) { std::cout

@marty1885 thanks, Confirmed that it can work

@an-tao 你觉得有没有必要集成一个 httpClient pool 的实现, 目前我们是自己实现了一个httpClient pool

Sorry,I am not qualified to demand anything, but let me share my personal feelings, We compared cpp ,Golang and Rust, ,their(rust,Golang ) grphql framework makes it easier for a novice...