-
-
Notifications
You must be signed in to change notification settings - Fork 243
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
- axmol version: 2.8.0
- devices test on: host (linux)
- devices test on: Linux (arch 6.16.4-zen1-1-zen)
- developing environments
- cmake version: 4.1.1
- gcc 15.2.1
url is "http://??.??.??.??/searchLevels.php" (not revealing my ip sorry)
paramData is "searchString=s"
nginx version: nginx/1.27.4
void WebManager::post(std::string url,
std::string paramData,
bool cacheIt,
std::function<void(std::string)> onRequestCompleted)
{
url = formatURL(url);
SNLOG("Making a request to {}?{}", url, paramData);
if (cacheIt)
{
for (WebCache& cacheEntry : cache)
{
if (cacheEntry.url == url && cacheEntry.params == paramData)
{
SNLOG("{}?{} : Using cached data (No new params & url)", url, paramData);
onRequestCompleted(cacheEntry.response);
return;
}
}
}
auto request = new ax::network::HttpRequest();
request->setRequestType(ax::network::HttpRequest::Type::POST);
request->setUrl(url.c_str());
request->setRequestData(paramData.c_str(), paramData.size());
request->setHeaders({"Content-Type: application/x-www-form-urlencoded"});
request->setResponseCallback([this, cacheIt, url, paramData, onRequestCompleted, request](
ax::network::HttpClient* client, ax::network::HttpResponse* response) {
if (!response)
{
SNLOG("{}?{}: Response is a nullptr!", url, paramData);
}
if (response->isSucceed())
{
auto data = response->getResponseData();
std::string responseData(data->begin(), data->end());
if (cacheIt)
{
WebCache cacheEntry;
cacheEntry.url = url;
cacheEntry.response = responseData;
cacheEntry.params = paramData;
cache.push_back(cacheEntry);
SNLOG("{}?{} : Cached", url, paramData);
}
onRequestCompleted(responseData);
}
else
{
SNLOG("{}?{}: Request didn't succeed: {}", url, paramData, response->getResponseCode());
}
});
ax::network::HttpClient::getInstance()->send(request);
request->release();
}Output:
WebManager.cpp[post]:37 - Making a request to http://??.??.??.??/searchLevels.php?searchString=s
In the constructor of HttpClient!
[yasio][1756926864003][global] the yasio-4.3.2 is initialized, the size of per transport is 368 when object_pool enabled.
[yasio][1756926864004][global] sizeof(io_event)=80
[yasio][1756926864014][index: 0] connecting server ??.??.??.??(??.??.??.??):8080...
[yasio][1756926864119][index: 0] the connection #22 <192.168.0.147:46514> --> <??.??.??.??:8080> is established(sndbuf=87040, rcvbuf=131072).
[yasio][1756926864141][index: 0] the connection #22 is lost, ec=-24, where=0, detail:An existing connection was shutdown by local host!
WebManager.cpp[operator()]:85 - http://??.??.??.??:8080/searchLevels.php?searchString=s: Request didn't succeed: 400
Used the code above since v2.2.1, worked fine until v2.8.0. I also reviewed diff between v2.7.1..v2.8.0, found nothing that could cause this. Doesn't seem to be an issue with yasio (last commit was 2 months ago)
This is not an issue on a server side, requests through curl and python's requests succeed just fine
Same issue occurs in a new project
GET requests work fine though
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working