void appendAttributesFromLogin(nsILoginInfo *aLogin, GnomeKeyringAttributeList* attrList) { typedef nsILoginInfo L; copyAttribute(attrList, aLogin, &L::GetHostname, kHostnameAttr); copyAttribute(attrList, aLogin, &L::GetUsername, kUsernameAttr); copyAttribute(attrList, aLogin, &L::GetUsernameField, kUsernameFieldAttr); copyAttribute(attrList, aLogin, &L::GetPasswordField, kPasswordFieldAttr); // formSubmitURL and httpRealm are not guaranteed to be set. copyAttributeOr(attrList, aLogin, &L::GetFormSubmitURL, kFormSubmitURLAttr); copyAttributeOr(attrList, aLogin, &L::GetHttpRealm, kHttpRealmAttr); }
void KVNetworkReply::handleResponse() { if(d->finished) return; setError(d->copied->error(), d->copied->errorString()); copyAttribute(QNetworkRequest::HttpStatusCodeAttribute); copyAttribute(QNetworkRequest::HttpReasonPhraseAttribute); copyAttribute(QNetworkRequest::RedirectionTargetAttribute); copyAttribute(QNetworkRequest::ConnectionEncryptedAttribute); copyAttribute(QNetworkRequest::SourceIsFromCacheAttribute); copyAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute); QList<QNetworkReply::RawHeaderPair> headers = d->copied->rawHeaderPairs(); for(int i = 0; i < headers.size(); i++) setRawHeader(headers[i].first, headers[i].second); QByteArray data = d->copied->readAll(); d->copied->abort(); //qDebug() << "content:" << data; this->postToTool(data); this->writeToDisk(data); if(d->translate) data = KVTranslator::instance().translateJson(data, d->copied->url().path().split("/").last()); d->content = data; d->offset = 0; setHeader(QNetworkRequest::ContentLengthHeader, QVariant(d->content.size())); open(ReadOnly | Unbuffered); //qDebug() << "translated:" << d->content.constData(); d->finished = true; emit finished(); emit readChannelFinished(); }