MXS-2219 Make a non-URL async HTTP request READY
An asynchronous HTTP request for 0 URLs is immediately in READY state.
This commit is contained in:
@ -502,6 +502,13 @@ Async get_async(const std::vector<std::string>& urls,
|
|||||||
const Config& config)
|
const Config& config)
|
||||||
{
|
{
|
||||||
shared_ptr<Async::Imp> sImp;
|
shared_ptr<Async::Imp> sImp;
|
||||||
|
|
||||||
|
if (urls.empty())
|
||||||
|
{
|
||||||
|
sImp = std::make_shared<ReadyImp>(Async::READY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
shared_ptr<HttpImp> sHttp_imp = std::make_shared<HttpImp>();
|
shared_ptr<HttpImp> sHttp_imp = std::make_shared<HttpImp>();
|
||||||
if (sHttp_imp->initialize(urls, user, password, config))
|
if (sHttp_imp->initialize(urls, user, password, config))
|
||||||
{
|
{
|
||||||
@ -511,6 +518,7 @@ Async get_async(const std::vector<std::string>& urls,
|
|||||||
{
|
{
|
||||||
sImp = std::make_shared<ReadyImp>(Async::ERROR);
|
sImp = std::make_shared<ReadyImp>(Async::ERROR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Async(sImp);
|
return Async(sImp);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user