cocosJS3.7 hot update failed in Android

Hello everyone,
I tried Hot Update in cocos3.7 JS
It worked well in IOS,but failed in Android.

I got some error log in Eclipse:

08-17 18:47:37.170: D/cocos2d-x debug info(28568): JS: storagePath is /data/data/com.ok.androidtest/files/
08-17 18:47:37.170: D/cocos2d-x debug info(28568): JS: local res/project.manifest file is loaded
08-17 18:47:37.270: D/cocos2d-x debug info(28568): JS: 0%
08-17 18:47:37.270: D/cocos2d-x debug info(28568): JS: Start to update 1 files from remote package.
08-17 18:47:37.300: D/cocos2d-x debug info(28568): JS: Asset update error: , Can not get content size of file (http://myserver/res/Images/update1.zip) : Request header failed
08-17 18:47:37.480: D/cocos2d-x debug info(28568): JS: AssetsManager::onExit

Could you tell me something about the error? Thanks

I faced with the same error too.

Downloader.cpp

  Downloader::HeaderInfo Downloader::prepareHeader(const std::string &srcUrl, void* header/* = nullptr */)
{
    bool headerGiven = true;
    HeaderInfo info;
    info.valid = false;
    
    if (!header)
    {
        headerGiven = false;
        header = curl_easy_init();
    }
    
    curl_easy_setopt(header, CURLOPT_URL, srcUrl.c_str());
    curl_easy_setopt(header, CURLOPT_HEADER, 1);
    curl_easy_setopt(header, CURLOPT_NOBODY, 1);
    curl_easy_setopt(header, CURLOPT_NOSIGNAL, 1);
    if (curl_easy_perform(header) == CURLE_OK)
    {
        char *url;
        char *contentType;
        curl_easy_getinfo(header, CURLINFO_EFFECTIVE_URL, &url);
        curl_easy_getinfo(header, CURLINFO_CONTENT_TYPE, &contentType);
        curl_easy_getinfo(header, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &info.contentSize);
        curl_easy_getinfo(header, CURLINFO_RESPONSE_CODE, &info.responseCode);
        
        if (contentType == nullptr || info.contentSize == -1 || info.responseCode >= 400)
        {
            info.valid = false;
            info.contentType = contentType;
        }
        else
        {
            info.url = url;
            info.contentType = contentType;
            info.valid = true;
        }
    }
    
    if (info.valid && _onHeader)
    {
        _onHeader(srcUrl, info);
    }
    else if (!info.valid)
    {
        info.contentSize = -1;
        std::string msg = StringUtils::format("Can not get content size of file (%s) : Request header failed", srcUrl.c_str());
        this->notifyError(ErrorCode::PREPARE_HEADER_ERROR, msg);
    }
    
    if (!headerGiven) {
        curl_easy_cleanup(header);
    }
    
    return info;
}

In My case,Update will fail info.valid is false ( info.responseCode is 416 and info.contentSize is -1).
Ignoring the info.responseCode is 416 and info.contentSize is -1 updates will go well.
However, it should never be well.
The solution I’m looking for.

Hello @gokuraku

Thank you for your reply.

I tested in my local server with the same code , it worked well .

So I think it may be a server config problem.

Hello @xiongdi9456
Thank you for the information!
Official tests project is running well, It seems there is a possibility of server configuration problems.
If you get the additional information,please let me know.
Thank you,