void QHttpNetworkConnectionChannel::_q_encrypted() { QSslSocket *sslSocket = qobject_cast<QSslSocket *>(socket); Q_ASSERT(sslSocket); if (!protocolHandler) { switch (sslSocket->sslConfiguration().nextProtocolNegotiationStatus()) { case QSslConfiguration::NextProtocolNegotiationNegotiated: { QByteArray nextProtocol = sslSocket->sslConfiguration().nextNegotiatedProtocol(); if (nextProtocol == QSslConfiguration::NextProtocolHttp1_1) { // fall through to create a QHttpProtocolHandler } else if (nextProtocol == QSslConfiguration::NextProtocolSpdy3_0) { protocolHandler.reset(new QSpdyProtocolHandler(this)); connection->setConnectionType(QHttpNetworkConnection::ConnectionTypeSPDY); // no need to re-queue requests, if SPDY was enabled on the request it // has gone to the SPDY queue already break; } else { emitFinishedWithError(QNetworkReply::SslHandshakeFailedError, "detected unknown Next Protocol Negotiation protocol"); break; } } case QSslConfiguration::NextProtocolNegotiationNone: protocolHandler.reset(new QHttpProtocolHandler(this)); connection->setConnectionType(QHttpNetworkConnection::ConnectionTypeHTTP); // re-queue requests from SPDY queue to HTTP queue, if any requeueSpdyRequests(); break; case QSslConfiguration::NextProtocolNegotiationUnsupported: emitFinishedWithError(QNetworkReply::SslHandshakeFailedError, "chosen Next Protocol Negotiation value unsupported"); break; default: emitFinishedWithError(QNetworkReply::SslHandshakeFailedError, "detected unknown Next Protocol Negotiation protocol"); } } if (!socket) return; // ### error state = QHttpNetworkConnectionChannel::IdleState; pendingEncrypt = false; if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY) { // we call setSpdyWasUsed(true) on the replies in the SPDY handler when the request is sent if (spdyRequestsToSend.count() > 0) // wait for data from the server first (e.g. initial window, max concurrent requests) QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } else { // HTTP if (!reply) connection->d_func()->dequeueRequest(socket); if (reply) { reply->setSpdyWasUsed(false); emit reply->encrypted(); } if (reply) sendRequest(); } }
void MetadataJob::doStart() { if (!m_core) { emitFinishedWithError(Job::Canceled, tr("Missing package manager core engine.")); return; // We can't do anything here without core, so avoid tons of !m_core checks. } const ProductKeyCheck *const productKeyCheck = ProductKeyCheck::instance(); if (!m_addCompressedPackages) { reset(); emit infoMessage(this, tr("Preparing meta information download...")); const bool onlineInstaller = m_core->isInstaller() && !m_core->isOfflineOnly(); if (onlineInstaller || m_core->isMaintainer()) { QList<FileTaskItem> items; foreach (const Repository &repo, m_core->settings().repositories()) { if (repo.isEnabled() && productKeyCheck->isValidRepository(repo)) { QAuthenticator authenticator; authenticator.setUser(repo.username()); authenticator.setPassword(repo.password()); if (!repo.isCompressed()) { QString url = repo.url().toString() + QLatin1String("/Updates.xml?"); if (!m_core->value(scUrlQueryString).isEmpty()) url += m_core->value(scUrlQueryString) + QLatin1Char('&'); // also append a random string to avoid proxy caches FileTaskItem item(url.append(QString::number(qrand() * qrand()))); item.insert(TaskRole::UserRole, QVariant::fromValue(repo)); item.insert(TaskRole::Authenticator, QVariant::fromValue(authenticator)); items.append(item); } else { qDebug() << "Trying to parse compressed repo as normal repository."\ "Check repository syntax."; } } } if (items.count() > 0) { startXMLTask(items); } else { emitFinished(); } } else {