void FeedFetcher::readData(const QHttpResponseHeader& response_header) { if(!impl_->current_feed_.get()) return; int statusCode = response_header.statusCode(); qDebug() << statusCode; if (statusCode == 200) { //TODO in order to insert CDATA to invalid XML atom, //we need capture data of full page bytes_.append(impl_->http_->readAll()); // qDebug() << bytes_.size() << " bytes received."; // insert CDATA FLAG if not exists } else if ((statusCode >300 || statusCode <300) && (response_header.hasKey("location") || response_header.hasKey("Location"))) { qDebug()<<response_header.statusCode(); QUrl location = QUrl(response_header.value("location")); if (location.isEmpty()) { location = QUrl(response_header.value("Location")); } qDebug() << location; impl_->http_.get()->setHost(location.host(),80); impl_->connection_id_ = impl_->http_.get()->get(location.toString()); } else if (statusCode == 404) { //NOTE: Do Nothing qDebug() << "404 !!"; } else { qDebug() << "Received non-200 response code: " << statusCode << response_header.toString(); } }
void SmugMug::WebService::_slotHttpReadyRead (const QHttpResponseHeader &resp) { QHttp &theHttp = (_ssl ? _https : _http); if (resp.statusCode () != 200) { QString msg = QString ("[%1] %2").arg (resp.statusCode ()).arg (resp.reasonPhrase ()); _logHttpError (msg); theHttp.abort(); } else { const qint64 MaxLen (theHttp.bytesAvailable ()); if (MaxLen) { char *buffer = new char [MaxLen+1]; memset (buffer, 0, MaxLen+1); qint64 count = theHttp.read (buffer, MaxLen); _dataIn.append (buffer); delete [] buffer; buffer = 0; qDebug () << "Read Ready: " << count << " of " << MaxLen; } } }
void FlexWatchCam::httpReadyRead(const QHttpResponseHeader & resp) { if(resp.statusCode() != 200) QMessageBox::warning(0, "Error", tr("StatusCode = %1").arg(resp.statusCode())); else { QByteArray array = http_.readAll(); processing(array); } }
void MythHttpHandler::ResponseHeaderReceived(const QHttpResponseHeader &resp) { QMutexLocker locker(&m_lock); LOG(VB_NETWORK, LOG_DEBUG, LOC + QString("ResponseHeaderReceived(%1,%2) url: %3") .arg(resp.statusCode()).arg(resp.reasonPhrase()) .arg(m_cur_url.toString())); m_cur_status_id = resp.statusCode(); m_cur_status_str = resp.reasonPhrase(); }
void HttpFileReceiver::readResponseHeader(const QHttpResponseHeader &responseHeader) { if ( responseHeader.statusCode() >= 400 ) { fetcher->httpRequestAborted = true; QString detailedError( "HttpFileReceiver::readReasponseHeader:- status code: %1 " "reason phrase: %2" ); detailedError = detailedError.arg( responseHeader.statusCode() ) .arg( responseHeader.reasonPhrase() ); fetcher->error = detailedError; } }
void BrisaMSearchClientCP::datagramReceived() { while (udpListener->hasPendingDatagrams()) { QByteArray Datagram; Datagram.resize(udpListener->pendingDatagramSize()); udpListener->readDatagram(Datagram.data(), Datagram.size()); QString temp(Datagram); QHttpResponseHeader *response = new QHttpResponseHeader(temp); if (response->statusCode() == 200) { QString usn = response->value("usn"); if (usn.startsWith("uuid:")) { qDebug() << "BrisaMSearch received MSearch answer from " << usn << ""; emit msearchResponseReceived(response->value("usn"), response->value("location"), response->value("st"), response->value("ext"), response->value("server"), response->value("cache-control")); } else { qDebug() << "BrisaMSearch received MSearch from " << response->value("location") << " but it does not start with string \"uuid:\". USN field is " << usn; } } delete response; } }
void HttpGet::httpResponseHeader(const QHttpResponseHeader &resp) { // if there is a network error abort all scheduled requests for // this download m_response = resp.statusCode(); // 301 -- moved permanently // 302 -- found // 303 -- see other // 307 -- moved temporarily // in all cases, header: location has the correct address so we can follow. if(m_response == 301 || m_response == 302 || m_response == 303 || m_response == 307) { //abort without sending any signals http.blockSignals(true); http.abort(); http.blockSignals(false); // start new request with new url qDebug() << "[HTTP] response =" << m_response << "- following"; getFile(resp.value("location") + m_query); } else if(m_response != 200) { // all other errors are fatal. http.abort(); qDebug() << "[HTTP] Response error:" << m_response << resp.reasonPhrase(); } }
/** * Checks for the status code and aborts the request if needed. */ void TextBrowser::onResponseHeaderReceived(const QHttpResponseHeader &responseHeader) { if (responseHeader.statusCode() != 200) { stateChanged(tr("Download failed: %1.").arg(responseHeader.reasonPhrase())); d->http->abort(); } }
void DJDownloadManager::httpReadyRead ( const QHttpResponseHeader & response ) { int status = response.statusCode(); djDebug() << "httpReadyRead" << status << m_file->fileName(); if ( !m_file->fileName().isEmpty() ) m_file->write( m_http->readAll() ); }
void DBoxFE_ProfileWizard::readResponseHeader( const QHttpResponseHeader &responseHeader ) { if ( responseHeader.statusCode() != 200 ) { QMessageBox::information( this, dbfe->winTitle(), tr( "Download failed: %1." ).arg( responseHeader.reasonPhrase() ) ); httpRequestAborted = true; m_http->abort(); return ; } }
void ownCloudInfo::qhttpResponseHeaderReceived(const QHttpResponseHeader& header) { qDebug() << "Resp:" << header.toString(); if (header.statusCode() == 201) emit webdavColCreated( QNetworkReply::NoError ); else qDebug() << "http request failed" << header.toString(); }
void FileDownloader::readResponseHeader(const QHttpResponseHeader &responseHeader) { if (responseHeader.statusCode() != 200) { emit downloadFailed(responseHeader.reasonPhrase()); http_request_aborted = true; hide(); http->abort(); return; } }
void UtubeData::readData(const QHttpResponseHeader &resp) { if (resp.statusCode() != 200) { mHttp->abort(); qDebug() << "UTUBE: Error." << endl; } else { mXml.addData(mHttp->readAll()); parseXml(); } }
void RSSFetcher::readData(const QHttpResponseHeader &resp) { if (resp.statusCode() != 200) m_http.abort(); else { m_xml.addData(m_http.readAll()); parseXml(); } }
void ArchLinuxNewsReader::readData(const QHttpResponseHeader &resp) { if (resp.statusCode() != 200) http->abort(); else { xml.addData(http->readAll()); parseXml(); } }
void RSSListing::readData(const QHttpResponseHeader &resp) { if (resp.statusCode() != 200) http.abort(); else { xml.addData(http.readAll()); parseXml(); } }
void HttpEngine::handleUploadHeaders(QHttpResponseHeader header) { if(header.statusCode() != 200) throw header.reasonPhrase(); qint64 clen = header.value("content-length").toLongLong(); while(m_strResponse.size() < clen) m_strResponse += m_pRemote->read(1024); emit finished(false); }
void HttpThread::readResponseHeader(QHttpResponseHeader const& responseHeader) { qDebug() << "httpResponseHeader" << responseHeader.statusCode(); switch (responseHeader.statusCode()) { case 200: // Ok case 301: // Moved Permanently case 302: // Found case 303: // See Other case 307: // Temporary Redirect break; // these are not error conditions default: m_errorMessage = "HTTP request failed: " + responseHeader.reasonPhrase(); qDebug() << "Error message:" << m_errorMessage; m_terminate = true; m_httpActive = false; m_http->abort(); } }
void SmugMug::WebService::_slotDownloadHttpReadyRead (const QHttpResponseHeader &resp) { if (_downloadId) { qDebug () << "_slotDownloadHttpReadyRead" << resp.statusCode () << resp.reasonPhrase (); if (resp.statusCode () != 200) { qWarning () << "---- Download Http Error -----------------------------------"; qWarning () << "Response Reason:" << resp.reasonPhrase () << endl << "Request:" << _downloadHttp.currentRequest ().path () << endl << "Bytes returned:" << _downloadHttp.bytesAvailable () << endl << "-----------------------------------------------------" << endl; _downloadAborted = true; _downloadHttp.abort(); } } }
void Gmail::readData(const QHttpResponseHeader &resp) { if (resp.statusCode() != 200) { http.abort(); //emit probleme de connection } else { xml.addData(http.readAll()); getEmails(); } }
/*---------------------------------------------------------------------------*/ QVariant HttpRecognizer::comment( IConnection* connection ) { Q_ASSERT (connection); if (!mConnections.contains( connection->networkInfo() )) return "No comment yet"; const HttpConnection con = mConnections.value( connection->networkInfo() ); const QHttpRequestHeader request = con.lastRequestHeader(); const QHttpResponseHeader response = con.lastResponseHeader(); return request.method() + " " + request.value( "host" ) + request.path() + (response.isValid() ? "\nHTTP " + QString::number( response.statusCode() ) + " " + response.reasonPhrase() : "" ); }
void SimpleHttp::readResponseHeader(const QHttpResponseHeader &responseHeader) { qDebug("SimpleHttp::readResponseHeader: statusCode: %d", responseHeader.statusCode()); if (responseHeader.statusCode() == 301) { QString new_url = responseHeader.value("Location"); qDebug("SimpleHttp::readResponseHeader: Location: '%s'", new_url.toLatin1().constData()); download(new_url); } else if (responseHeader.statusCode() == 302) { QString location = responseHeader.value("Location"); qDebug("SimpleHttp::readResponseHeader: Location: '%s'", location.toLatin1().constData()); /* http_get_id = get( location ); */ download(location); } else if (responseHeader.statusCode() != 200) { qDebug("SimpleHttp::readResponseHeader: error: '%s'", responseHeader.reasonPhrase().toLatin1().constData()); emit downloadFailed(responseHeader.reasonPhrase()); abort(); } }
void DownloadHandler::readResponseHeader( const QHttpResponseHeader &responseHeader ) { const QString contentType("Content-Type"); #if USE_TRACE TRACESTART(DownloadHandler::readResponseHeader) #endif if( (responseHeader.statusCode() >= 300) && (responseHeader.statusCode() < 400) ) { TheMagic *magic = new TheMagic( *mpTheMagic ); magic->mURL = responseHeader.value("location"); mpMagicQueue->addMagic( magic ); mpTheMagic->fail(); } else if( responseHeader.statusCode() != 200 ) { errorMessage( mpTheMagic->mURL + ":" + QString::number( responseHeader.statusCode() ) + " " + responseHeader.reasonPhrase() ); mpTheMagic->fail(); } if( responseHeader.hasContentType() ) { mpTheMagic->setContentType( responseHeader.contentType() ); } const QString setCookie("Set-Cookie"); QList<QPair<QString, QString> > values( responseHeader.values() ); for( int i = 0; i < values.size(); i++ ) { if( !QString::compare(values.at(i).first, setCookie, Qt::CaseInsensitive) ) { #if USE_TRACE TRACEMSG << values.at(i).second; #endif mCookieJar.store( values.at(i).second ); } } }
void CHttpImageDownloader::readResponseHeader(const QHttpResponseHeader &responseHeader) { switch (responseHeader.statusCode()) { case 200: // Ok case 301: // Moved Permanently case 302: // Found case 303: // See Other case 307: // Temporary Redirect // these are not error conditions break; http->abort(); } }
void OracleImporter::readResponseHeader(const QHttpResponseHeader &responseHeader) { switch (responseHeader.statusCode()) { case 200: case 301: case 302: case 303: case 307: break; default: QMessageBox::information(0, tr("HTTP"), tr("Download failed: %1.").arg(responseHeader.reasonPhrase())); http->abort(); deleteLater(); } }
void Reader::loginHeaderReceived( const QHttpResponseHeader & resp ) { DEBUG_BLOCK ContentFetcher* http = (ContentFetcher*) sender(); disconnect( http, SIGNAL( responseHeaderReceived( const QHttpResponseHeader & ) ) , this, SLOT( loginHeaderReceived( const QHttpResponseHeader & ) ) ); if( resp.statusCode() == 401 /*authorization required*/) { emit passwordRequired(); http->deleteLater(); return; } connect( http, SIGNAL( requestFinished( int, bool ) ), this, SLOT( loginFinished( int, bool ) ) ); }
void HttpCore::readResponseHeader(const QHttpResponseHeader &responseHeader){ switch (responseHeader.statusCode()) { case 200: // Ok case 301: // Moved Permanently case 303: // See Other case 307: // Temporary Redirect // these are not error conditions break; default: emit(requestError(tr("Download failed: %1.").arg(responseHeader.reasonPhrase())));; this->aborted=true; http->abort(); } return; }
void Network::readResponseHeader(const QHttpResponseHeader &responseHeader) { switch (responseHeader.statusCode()) { case 200: // Ok case 301: // Moved Permanently case 302: // Found case 303: // See Other case 307: // Temporary Redirect // these are not error conditions break; default: //QMessageBox::information(this, tr("HTTP"), tr("Download failed: %1.").arg(responseHeader.reasonPhrase())); qDebug("Download failed."); httpRequestAborted = true; http->abort(); } }
//! [1] void RSSListing::readData(const QHttpResponseHeader &resp) { bool ok; if (resp.statusCode() != 200) http.abort(); else { xmlInput.setData(http.readAll()); if (newInformation) { ok = xmlReader.parse(&xmlInput, true); newInformation = false; } else ok = xmlReader.parseContinue(); if (!ok) http.abort(); } }
void PluginGmail::readData(const QHttpResponseHeader &resp) { Bunny * bunny = BunnyManager::GetBunny(this, http.property("BunnyID").toByteArray()); if (resp.statusCode() != 200) { http.abort(); LogWarning("Connection error"); } else { xml.addData(http.readAll()); while (!xml.atEnd()) { xml.readNext(); if (xml.isStartElement()) { currentTag = xml.name().toString(); } else if (xml.isCharacters() && !xml.isWhitespace()) { if (currentTag == "fullcount") { bool ok; emailsCount = xml.text().toString().toInt(&ok); if (emailsCount > 0) { bunny->SendPacket(AmbientPacket(AmbientPacket::Service_Nose, 1)); } else { bunny->SendPacket(AmbientPacket(AmbientPacket::Service_Nose, 0)); } } } } } }