Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

显示“网络请求错误”是怎么回事 #3

Closed
nafuchan opened this issue Jan 16, 2022 · 10 comments
Closed

显示“网络请求错误”是怎么回事 #3

nafuchan opened this issue Jan 16, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@nafuchan
Copy link

Snipaste_2022-01-16_22-29-17

@vooidzero
Copy link
Owner

@yujiahuahua 不清楚,我这是正常的

@wjfengkook
Copy link

我也遇到相同的问题,换电脑都不行,应该是和网络有关,我用的是移动的宽带

@vooidzero
Copy link
Owner

@yujiahuahua @wjfengkook

代码有个遗留小问题,试试 Release 新上传的版本

@wjfengkook
Copy link

0.9.5.4版本还是有这个问题!

@vooidzero
Copy link
Owner

@wjfengkook 那我也没办法,我不知道你那具体情况是什么,没办法复现,不知道哪个环节出了问题。
"网络请求错误"这个报错属于是,无网络连接、连接超时、代理设置错误这种。

// Network.cpp
std::pair<QJsonObject, QString> Bili::parseReply(QNetworkReply *reply, const QString& requiredKey)
{
    if (reply->error() != QNetworkReply::NoError) {
        qDebug() << "network error:" << reply->errorString() << ", url=" << reply->url().toString();
        return { QJsonObject(), "网络请求错误" };
    }
    if (!reply->header(QNetworkRequest::ContentTypeHeader).toString().contains("json")) {
        return { QJsonObject(), "http请求错误" };
    }
    ......
}

如果你需要/愿意的话,可以下载微软提供的 DebugView (1.3 MB) 来获取以上代码输出的错误提示

  1. 解压缩 DebugView.zip,运行 dbgview64.exe
  2. 运行 B23Dld.exe,复现该问题
  3. 如下图,(1) 和 (2) 是 B23Dld 输出的,(3) 是其他应用输出的。其中开头的 [2028], [12124] 是进程 ID
    (1) 是运行 B23Dld 后有 cookie 所以发了个请求获取用户名和头像信息,http 请求成功输出了 "reply from ..."
    (2) 是我制造了个断网环境,然后获取视频信息失败,于是输出了 "network error: ..."
    DebugView Screenshot

@wjfengkook
Copy link

00000001 0.00000000 [1532] qt.network.ssl: No functional TLS backend was found
00000002 0.00010010 [1532] qt.network.ssl: No functional TLS backend was found
00000003 0.00011430 [1532] qt.network.ssl: No functional TLS backend was found
00000004 0.00015930 [1532] qt.network.ssl: No TLS backend is available
00000005 0.00018430 [1532] qt.network.ssl: No functional TLS backend was found
00000006 0.00020940 [1532] qt.network.ssl: No functional TLS backend was found
00000007 0.00023020 [1532] qt.network.ssl: No functional TLS backend was found
00000008 0.00025080 [1532] qt.network.ssl: No functional TLS backend was found
00000009 0.00027060 [1532] qt.network.ssl: No TLS backend is available
00000010 0.00029120 [1532] qt.network.ssl: No functional TLS backend was found
00000011 0.00031240 [1532] qt.network.ssl: No functional TLS backend was found
00000012 0.35026529 [1532] qt.network.ssl: No functional TLS backend was found
00000013 0.35035199 [1532] qt.network.ssl: No functional TLS backend was found
00000014 0.35038501 [1532] qt.network.ssl: No TLS backend is available
00000015 0.35042590 [1532] qt.network.ssl: No functional TLS backend was found
00000016 0.35045061 [1532] qt.network.ssl: No functional TLS backend was found
00000017 0.35048050 [1532] qt.network.ssl: No functional TLS backend was found
00000018 0.35051009 [1532] qt.network.ssl: No functional TLS backend was found
00000019 0.35054010 [1532] qt.network.ssl: No TLS backend is available
00000020 0.35061169 [1532] qt.network.ssl: No functional TLS backend was found
00000021 0.35064191 [1532] qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
00000022 0.35085040 [1532] network error: "TLS initialization failed" , url= "https://passport.bilibili.com/qrcode/getLoginUrl"

@vooidzero
Copy link
Owner

@wjfengkook 感谢反馈!
这个是 SSL 库 dll 加载的问题,应该是缺少 msvcr100.dll

你可以:

  • 下载 msvcr100.dll 并放到目录 C:\Windows\System32
  • 或下载 Release 新发布的版本(版本号还是 0.9.5.4)

SSL 库的这个问题早在 README.md/#build-issues 提过,其中参考的 stackoverflow 回答就提到了 msvcr100.dll 依赖问题,不过我自己机器上有,当时也没在意。

The reason came out to be that OpenSSL DLLs depend on another MSVC runtime version than the Qt app itself, and these errors go unreported. Open these DLLs in Dependency Walker to find out what's missing. In my case it was MSVCR100.dll

libssl-1_1-x64.dll 和 libcrypto-1_1-x64.dll 一直都是有打包的。这两依赖的 dll 除了系统核心 dll 外,还有 bcrypt.dll(这个貌似也是本来就有的)和 msvcr100.dll。我从微软官方下了个 win10 虚拟机 测试,里面缺少 msvcr100.dll,问题复现了出来,加入 msvcr100.dll 后问题解决。

@vooidzero vooidzero pinned this issue Jan 20, 2022
@wjfengkook
Copy link

非常好,感谢修复!

@itnikita
Copy link

network error: "Error transferring https://api.bilibili.com/nav

@Norlin0414
Copy link

我在0.9.5.8也遇到了这个问题要怎么解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants