-
-
Notifications
You must be signed in to change notification settings - Fork 79
Closed
Labels
bugSomething isn't workingSomething isn't workingwindowsWindows/MSVC-specific issuesWindows/MSVC-specific issues
Description
I'm in China and can't access YouTube without a VPN.
There is a crash problem here.
The call to setTransferTimeout() is bound to crash if it doesn't reply with data within the time set by the parameter.
void MainWindow::on_pushButton_clicked()
{
fetchData(QString("https://www.youtube.com/"))
.then([](const QByteArray &bytes) {
qDebug().noquote() << "fetch data success:" << bytes;
}, [](const std::exception& e) {
qDebug() << "fetch data error:" << e.what();
});
}
QCoro::Task<QByteArray> MainWindow::fetchData(const QUrl &url)
{
qDebug() << "request:" << url.toString();
QNetworkRequest request(url);
// request.setTransferTimeout(10000);
QNetworkAccessManager manager;
const auto reply = co_await manager.get(request);
if (reply->error() != QNetworkReply::NoError) {
qDebug() << "request error" << reply->errorString();
co_return {};
}
co_return reply->readAll();
}running environment: Qt_5_15_2_MSVC2019_32bit-Debug
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingwindowsWindows/MSVC-specific issuesWindows/MSVC-specific issues