当前位置: 首页>>代码示例>>C++>>正文


C++ QNetworkReply::rawHeaderList方法代码示例

本文整理汇总了C++中QNetworkReply::rawHeaderList方法的典型用法代码示例。如果您正苦于以下问题:C++ QNetworkReply::rawHeaderList方法的具体用法?C++ QNetworkReply::rawHeaderList怎么用?C++ QNetworkReply::rawHeaderList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QNetworkReply的用法示例。


在下文中一共展示了QNetworkReply::rawHeaderList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update

void RequestModel::update()
{
    QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
    if (!reply)
        return;

    int offset;
    for (offset = m_requests.count() - 1; offset >= 0; --offset) {
        if (m_requests[offset].reply == reply)
            break;
    }
    if (offset < 0)
        return;

    // Save reply headers
    foreach (const QByteArray &header, reply->rawHeaderList() ) {
        QPair<QByteArray, QByteArray> pair(header, reply->rawHeader(header));
        m_requests[offset].replyHeaders.append(pair);
    }

    // Save reply info to be displayed
    int status = reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt();
    QString reason = reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString();
    m_requests[offset].response = QString(QLatin1String("%1 %2")).arg(status).arg(reason);
    m_requests[offset].length = reply->header(QNetworkRequest::ContentLengthHeader).toInt();
    m_requests[offset].contentType = reply->header(QNetworkRequest::ContentTypeHeader).toString();

    if (status == 302) {
        QUrl target = reply->attribute( QNetworkRequest::RedirectionTargetAttribute ).toUrl();
        m_requests[offset].info = tr("Redirect: %1").arg(target.toString());
    }
}
开发者ID:porphyr,项目名称:arora,代码行数:32,代码来源:networkmonitor.cpp

示例2:

QList<QByteArray> QNetworkReplyProto::rawHeaderList() const
{
  QNetworkReply *item = qscriptvalue_cast<QNetworkReply*>(thisObject());
  if (item)
    return item->rawHeaderList();
  return QList<QByteArray>();
}
开发者ID:Dinesh-Ramakrishnan,项目名称:qt-client,代码行数:7,代码来源:qnetworkreplyproto.cpp

示例3: main

int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);

    QNetworkAccessManager manager;

    if (argc != 2) {
        std::cout << "usage: " << argv[0] << " <url>" << std::endl;
        return 0;
    }

    QUrl url(app.arguments().value(1));
    QNetworkRequest request(url);

    QNetworkReply *reply = manager.get(request);
    app.connect(reply, SIGNAL(finished()), SLOT(quit()));
    app.exec();

    QFile outfile("request.header");
    if (outfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
        QTextStream stream(&outfile);
        QList<QByteArray> list = reply->rawHeaderList();
        foreach (QByteArray name, list) {
            stream << name << ": " << reply->rawHeader(name) << endl;
        }
开发者ID:longwei,项目名称:WebkitBridge,代码行数:25,代码来源:main.cpp

示例4: uploadReply

void YandexNarodUploadJob::uploadReply()
{
	m_timer.stop();
	debug() << "uploadReply";
	QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
	Q_ASSERT(reply);
	if (!processReply(reply))
		return;

	QByteArray data = reply->readAll();
	QVariantMap map = Json::parse(data).toMap();

	debug() << "upload" << data << map;
	debug() << reply->rawHeaderList();
	debug() << "upload" << reply->rawHeader("Set-Cookie");

	someStrangeSlot();
}
开发者ID:akahan,项目名称:qutim,代码行数:18,代码来源:yandexnaroduploadjob.cpp


注:本文中的QNetworkReply::rawHeaderList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。