mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-11-29 18:27:43 +08:00
To avoid accessing a null point, make sure result == OK before accessing the response ptr. (#1195)
This commit is contained in:
parent
dd63a72dab
commit
740c34fce3
@ -1,6 +1,7 @@
|
||||
#include <drogon/drogon.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
|
||||
using namespace drogon;
|
||||
|
||||
@ -20,7 +21,15 @@ int main()
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
client->sendRequest(
|
||||
req, [](ReqResult, const HttpResponsePtr &response) {
|
||||
req, [](ReqResult result, const HttpResponsePtr &response) {
|
||||
if (result != ReqResult::Ok)
|
||||
{
|
||||
std::cout
|
||||
<< "error while sending request to server! result: "
|
||||
<< result << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << "receive response!" << std::endl;
|
||||
// auto headers=response.
|
||||
++nth_resp;
|
||||
|
Loading…
Reference in New Issue
Block a user