s12mmm3 / QCloudMusicApi

Qt C++版 网易云音乐 API
MIT License
48 stars 13 forks source link

songUpload里面用wanproxy.127.net拿到的ip无法上传 #39

Closed zeyugao closed 2 weeks ago

zeyugao commented 2 weeks ago

这一段拿到的ip

https://github.com/s12mmm3/QCloudMusicApi/blob/17b9fa03dba75225e2046572a14b1c072842a4f9/QCloudMusicApi/plugins.cpp#L52-L60

上传的时候,qt的网络status( reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ) )是 Invalid 的,但是如果换成原来的 45.127.129.8 就是好的

zeyugao commented 2 weeks ago

类似于这样子

    for (const auto &i : lbs["upload"].toList()) {
        reply = Request::axios(
            QNetworkAccessManager::PostOperation,
            "http://" + i.toString() + "/" + bucket + "/" + objectKey + "?offset=0&complete=true&version=1.0",
            {},
            {
                { "x-nos-token", tokenRes["body"].toMap()["result"].toMap()["token"] },
                { "Content-MD5", query["songFile"].toMap()["md5"] },
                { "Content-Type", "audio/mpeg" },
                { "Content-Length", query["songFile"].toMap()["size"] },
            },
            query["songFile"].toMap()["data"].toByteArray());
        reply->manager()->deleteLater();

        QVariant statusCode = reply->attribute( QNetworkRequest::HttpStatusCodeAttribute );

        qDebug().noquote() << "URL: "<< i <<"statusCode" << statusCode;

        if (statusCode.isValid()) {
            int status = statusCode.toInt();
            if (status == 200) {
                break;
            }
        }
    }
image
s12mmm3 commented 2 weeks ago

nodejs的可以上传吗

zeyugao commented 2 weeks ago

但是如果换成原来的 45.127.129.8 就是好的

s12mmm3 commented 2 weeks ago

😂我看node的也传不了

zeyugao commented 2 weeks ago

额,我试的两个都是node的可以传,但是新的ip传不了,你用新的这个就是好的吗

s12mmm3 commented 2 weeks ago

emm我没有改ip,确实改成固定ip就可以上传了

s12mmm3 commented 2 weeks ago

嗯我明白了,lbs.upload[0]里面已经带有http协议了,songUpload又拼上去一个http,所以链接有问题