关于HttpQueryInfo的问题

Toxic_Obsidian Toxic_Obsidian 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
代码(查错部分已略去)

HINTERNET hInt = InternetOpenA( UA , INTERNET_OPEN_TYPE_DIRECT , NULL , NULL , 0 );
if( hInt == NULL ){
return 1;
}
HINTERNET hConn = InternetConnect( hInt , "dl.hdslb.com" , INTERNET_DEFAULT_HTTPS_PORT , NULL , NULL , INTERNET_SERVICE_HTTP , 0 , 0 );
if( hConn == NULL ){
return 1;
}
// https://dl.hdslb.com/mobile/latest/iBiliPlayer-bili.apk
HINTERNET hTar = HttpOpenRequestA( hConn , "GET" , "/mobile/latest/iBiliPlayer-bili.apk" , "HTTP/1.1" , NULL , NULL , INTERNET_FLAG_RELOAD , 0 );
if( hTar == NULL ){
return 1;
}
if( TRUE != HttpSendRequestA( hTar , NULL , 0 , NULL , 0 ) ){
return 1;
}
CHAR dwContLength1[200];
ZeroMemory( dwContLength1 , 200 );
DWORD dwContLenBufLen;
if( TRUE != HttpQueryInfo( hTar , HTTP_QUERY_CONTENT_LENGTH , dwContLength1 , &dwContLenBufLen , NULL ) ){
return 1;
}
DWORD dwContLength = atol(dwContLength1);
cout << "Buf length=" << dwContLenBufLen << endl;
cout << "Returned " << dwContLength1 << endl;
cout << "Length got!\n" << "app size=" << dwContLength << " Bytes\n" << "app size=" << dwContLength / (1024*1024) << " MiB\n";
InternetCloseHandle( hConn );
InternetCloseHandle( hInt );
getch();

从浏览器上下载https://dl.hdslb.com/mobile/latest/iBiliPlayer-bili.apk的时候获得的apk大小是76.2MiB,然而HttpQueryInfo的时候获得的是673 Bytes,请大虾们赐教哪里出了问题
注:错误处理已省略(怕各位大虾不想看这种冗余的东西)
...全文
评论 1
收藏 已收藏
分享
返回顶部