本文整理汇总了C++中Http::head方法的典型用法代码示例。如果您正苦于以下问题:C++ Http::head方法的具体用法?C++ Http::head怎么用?C++ Http::head使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::head方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void PluginTester::run()
{
stopFlag = false;
failed = 0;
emit workingStarted();
for (int n = 0; n < tests->count(); n++)
{
PluginTest *test = tests->at(n);
//
if ((onlyFailed && test->isTestOk()) || (onlySelected != -1 && n != onlySelected)) continue;
//
emit pluginTestRunning(test);
// get video information
emit workingProgress(n * 2, tests->count() * 2, QString("Getting <b>%1</b> video information... [1/2]").arg(test->getPluginTitle()));
VideoInformationPlugin *plugin = new VideoInformationPlugin(NULL, pluginsDir + test->getPluginFile());
VideoDefinition vd = plugin->getVideoInformation(test->getUrl());
// try to download video
emit workingProgress(n * 2 + 1, tests->count() * 2, QString("Testing <b>%1</b> video download... [2/2]").arg(test->getPluginTitle()));
Http *http = new Http();
if (!vd.cookies.isEmpty()) http->addCookies(vd.cookies);
if (!vd.headers.isEmpty()) http->addHeaderParameters(vd.headers);
int contentLength = copyBetween(http->head(QUrl(vd.URL)), "Content-Length: ", "\n").toInt();
delete http;
// update test info
test->setCaption(vd.title);
test->setFlvUrl(vd.URL);
test->setSize(contentLength);
// increase failed tests
if (!test->isTestOk()) failed++;
// destroy plugin
delete plugin;
// finished
emit pluginTestFinished(test);
// small pause, prevent 100% cpu
if (stopFlag) n = tests->count(); else sleep(1);
}
emit workingFinished(tests->count() - failed, failed);
}