本文整理汇总了C++中QNetworkReply::ignoreSslErrors方法的典型用法代码示例。如果您正苦于以下问题:C++ QNetworkReply::ignoreSslErrors方法的具体用法?C++ QNetworkReply::ignoreSslErrors怎么用?C++ QNetworkReply::ignoreSslErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QNetworkReply
的用法示例。
在下文中一共展示了QNetworkReply::ignoreSslErrors方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tr
double donationDialog::EUR2BTC()
{
QNetworkReply *rep = ((MainWindow*)parent())->mgr->get(QNetworkRequest(QUrl("https://blockchain.info/de/tobtc?currency=EUR&value=1")));
QByteArray raw;
rep->ignoreSslErrors();
lineEdit_payment2->setText(tr("getting current exchange rate..."));
comboBox->setEnabled(false);
horizontalSlider->setEnabled(false);
pushButton->setEnabled(false);
((MainWindow*)parent())->timeout.start();
while(rep->isRunning())
{
QCoreApplication::processEvents();
if(((MainWindow*)parent())->timeout.hasExpired(3000))
{
rep->abort();
}
}
comboBox->setEnabled(true);
horizontalSlider->setEnabled(true);
pushButton->setEnabled(true);
if(rep->error())
{
QMessageBox::warning(this, APPNAME, tr("Current exchange rate could not be determined!\n\nPlease specify the desired amount manually..."));
return 0.0;
}
raw = rep->readAll();
rep->deleteLater();
return raw.toDouble();
}
示例2: createRequest
QNetworkReply* MythNetworkAccessManager::createRequest(Operation op, const QNetworkRequest& req, QIODevice* outgoingData)
{
QNetworkReply* reply = QNetworkAccessManager::createRequest(op, req, outgoingData);
reply->ignoreSslErrors();
return reply;
}
示例3: sendTickerRequest
void BTCTrader::sendTickerRequest()
{
QNetworkReply* rpl;
rpl = request->get(QNetworkRequest(QUrl("https://mtgox.com/api/0/data/ticker.php")));
rpl->ignoreSslErrors();
}
示例4: findUsers
void TabbedMainWindow::findUsers(QString hostname, QString usernamepassword, int condition1, QString condition2, QString argument, QListWidget * list, QListWidget * list2) {
//First maybe we clear the dang list?!
QString condition1String, condition2String;
if (condition1 == 0) {
condition1String = "enduser.firstname";
} else if (condition1 == 1) {
condition1String = "enduser.middlename";
} else if (condition1 == 2) {
condition1String = "enduser.lastname";
} else if (condition1 == 3) {
condition1String = "enduser.userid";
} else if (condition1 == 4) {
condition1String = "enduser.islocaluser";
} else if (condition1 == 5) {
condition1String = "enduser.telephonenumber";
}
if (condition2 == "Equals") {
condition2String = "= '" + argument.toLower() + "'";
} else if (condition2 == "Contains") {
condition2String = "LIKE '%" + argument.toLower() + "%'";
} else if (condition2 == "Begins with") {
condition2String = "LIKE '" + argument.toLower() + "%'";
} else if (condition2 == "Ends with") {
condition2String = "LIKE '%" + argument.toLower() + "'";
} else if (condition2 == "Is Empty") {
condition2String = "IS NULL";
} else if (condition2 == "Is not Empty") {
condition2String = "IS NOT NULL";
} else if (condition2 == "True") {
condition2String = "= 't'";
} else if (condition2 == "False") {
condition2String = "= 'f'";
}
ProgressDialog progbar("CMClusters - Connecting...", "Please wait while a connection to the selected clusters are established!");
progbar.show();
QByteArray jsonString = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://www.cisco.com/AXL/API/8.5\">";
if (condition1 == 4) {
jsonString += "<soapenv:Body><ns:executeSQLQuery><sql>SELECT enduser.userid,enduser.firstname,enduser.middlename,enduser.lastname,enduser.islocaluser,enduser.telephonenumber from enduser where "
+ condition1String + condition2String + "</sql></ns:executeSQLQuery></SOAP-ENV:Envelope>";
} else {
jsonString += "<soapenv:Body><ns:executeSQLQuery><sql>SELECT enduser.userid,enduser.firstname,enduser.middlename,enduser.lastname,enduser.islocaluser,enduser.telephonenumber from enduser where lower("
+ condition1String + ") " + condition2String + "</sql></ns:executeSQLQuery></SOAP-ENV:Envelope>";
}
QByteArray postDataSize = QByteArray::number(jsonString.size());
QUrl req("https://" + hostname.toLocal8Bit() + ":8443/axl/");
QNetworkRequest request(req);
request.setRawHeader("SOAPAction", "\"CUCM:DB ver=8.5 executeSQLQuery\"");
request.setRawHeader("Authorization", "Basic " + usernamepassword.toLocal8Bit());
request.setRawHeader("Content-Type", "text/xml");
request.setRawHeader("Content-Length", postDataSize);
QNetworkAccessManager test;
QEventLoop loop;
connect(&test, SIGNAL(finished(QNetworkReply*)), &loop, SLOT(quit()));
QNetworkReply * reply = test.post(request, jsonString);
reply->ignoreSslErrors(); // Ignore only unsigned later on
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onError(QNetworkReply::NetworkError)));
loop.exec();
QByteArray response = reply->readAll();
QVariant statusCode = reply->attribute( QNetworkRequest::HttpStatusCodeAttribute );
if ( !statusCode.isValid() ) {
qDebug() << "Failed...";
qDebug() << statusCode.data();
}
int status = statusCode.toInt();
if ( status != 200 ) {
QString reason = reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString();
qDebug() << reason;
} else {
qDebug() << "Good reply";
//qDebug() << response;
QDomDocument doc;
doc.setContent(response);
QDomNodeList rates = doc.elementsByTagName("row");
for (int i = 0; i < rates.size(); i++) {
QString finalString;
QDomNode n = rates.item(i);
QDomElement firstname = n.firstChildElement("firstname");
if (firstname.text() != "")
finalString = firstname.text() + " ";
QDomElement middlename = n.firstChildElement("middlename");
if (middlename.text() != "")
finalString += middlename.text() + " ";
QDomElement lastname = n.firstChildElement("lastname");
if (lastname.text() != " ")
finalString += lastname.text();
QDomElement userid = n.firstChildElement("userid");
finalString += " (" + userid.text() + ") ";
QDomElement islocaluser = n.firstChildElement("islocaluser");
QDomElement telephonenumber = n.firstChildElement("telephonenumber");
if (telephonenumber.text() != "") {
finalString += " [" + telephonenumber.text() + "]";
//.........这里部分代码省略.........
示例5: createRequest
QNetworkReply* KNetwork::createRequest(Operation op, const QNetworkRequest& request, QIODevice* outgoingData)
{
QNetworkRequest req = request;
QUrl url = req.url();
//req.setRawHeader("Accept-Encoding","gzip");
//req.setRawHeader("Accept-Encoding","identity");
#if 0
KLog::log(QString("request:%1 %2\n%3")
.arg(url.scheme())
.arg(url.path())
.arg(base.path()));
#endif
#if 0
if (url.scheme() == "resource")
{
QString path = ":resources/" + url.toString(QUrl::RemoveScheme);
path.replace("//", "");
KLog::log(QString("resources:") + path);
return createRequestLocalFile(op, path, outgoingData);
}
#endif
// hack for AppleClasses
if (url.path().indexOf("AppleClasses") != -1 || url.path().indexOf("WidgetResources") != -1)
{
QString path = url.toLocalFile();
//todo replace path for AppleClasses
path.replace("/System/Library/WidgetResources", QApplication::applicationDirPath() + "/widgets/resources");
return createRequestLocalFile(op, path, outgoingData);
}
bool accessDenied = false;
// check access to local files outside of widget
if (!allowLocalAccess)
{
if (url.scheme() == "file" && base.isValid())
{
if (!base.isParentOf(url))
{
accessDenied = true;
}
}
}
// check network access
if (!allowNetworkAccess)
{
if (url.scheme() != "file")
{
accessDenied = true;
}
}
if (accessDenied)
{
// todo: show something meaningful
return createRequestLocalFile(op, "", outgoingData);
}
// check locale
if (url.scheme() == "file")
{
if (localefiles)
{
QString path;
if (localefiles->localized(url.toLocalFile(), path))
{
qDebug("localized: %s", qPrintable(path));
return createRequestLocalFile(op, path, outgoingData);
}
}
}
QNetworkReply *reply = QNetworkAccessManager::createRequest(op, request, outgoingData);
reply->ignoreSslErrors();
return reply;
}
示例6: sendReport
/*!
* \brief CrashReportDialog::sendReport
* Slot activated when mpSendReportButton clicked signal is raised.\n
* Sends the crash report alongwith selected log files.
*/
void CrashReportDialog::sendReport()
{
// ask for e-mail address.
if (mpEmailTextBox->text().isEmpty()) {
QMessageBox *pMessageBox = new QMessageBox;
pMessageBox->setWindowTitle(QString(Helper::applicationName).append(" - ").append(Helper::error));
pMessageBox->setIcon(QMessageBox::Critical);
pMessageBox->setAttribute(Qt::WA_DeleteOnClose);
pMessageBox->setText(tr("We can't contact you with a possible solution if you don't provide a valid e-mail address."));
pMessageBox->addButton(tr("Send without e-mail"), QMessageBox::AcceptRole);
pMessageBox->addButton(tr("Let me enter e-mail"), QMessageBox::RejectRole);
int answer = pMessageBox->exec();
switch (answer) {
case QMessageBox::RejectRole:
mpEmailTextBox->setFocus();
return;
case QMessageBox::AcceptRole:
default:
break;
}
}
// create the report.
QHttpMultiPart *pHttpMultiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
// email
QHttpPart emailHttpPart;
emailHttpPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"email\""));
emailHttpPart.setBody(mpEmailTextBox->text().toUtf8());
pHttpMultiPart->append(emailHttpPart);
// bug description
QHttpPart bugDescriptionHttpPart;
bugDescriptionHttpPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"bugdescription\""));
bugDescriptionHttpPart.setBody(mpBugDescriptionTextBox->toPlainText().toUtf8());
pHttpMultiPart->append(bugDescriptionHttpPart);
// OMEditCommunicationLogFile
if (mpOMEditCommunicationLogFileCheckBox->isChecked()) {
QHttpPart OMEditCommunicationLogFileHttpPart;
OMEditCommunicationLogFileHttpPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("text/plain"));
OMEditCommunicationLogFileHttpPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"omeditcommunication.log\"; filename=\"omeditcommunication.log\""));
QFile *pOMEditCommunicationLogFileFile = new QFile(mpOMEditCommunicationLogFileCheckBox->text());
pOMEditCommunicationLogFileFile->open(QIODevice::ReadOnly);
OMEditCommunicationLogFileHttpPart.setBodyDevice(pOMEditCommunicationLogFileFile);
pOMEditCommunicationLogFileFile->setParent(pHttpMultiPart); // file will be deleted when we delete pHttpMultiPart
pHttpMultiPart->append(OMEditCommunicationLogFileHttpPart);
}
// OMEditCommandsMosFile
if (mpOMEditCommandsMosFileCheckBox->isChecked()) {
QHttpPart OMEditCommandsMosFileHttpPart;
OMEditCommandsMosFileHttpPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("text/plain"));
OMEditCommandsMosFileHttpPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"omeditcommands.mos\"; filename=\"omeditcommands.mos\""));
QFile *pOMEditCommandsMosFile = new QFile(mpOMEditCommandsMosFileCheckBox->text());
pOMEditCommandsMosFile->open(QIODevice::ReadOnly);
OMEditCommandsMosFileHttpPart.setBodyDevice(pOMEditCommandsMosFile);
pOMEditCommandsMosFile->setParent(pHttpMultiPart); // file will be deleted when we delete pHttpMultiPart
pHttpMultiPart->append(OMEditCommandsMosFileHttpPart);
}
// OMStackTraceFile
if (mpOMStackTraceFileCheckBox->isChecked()) {
QHttpPart OMStackTraceFileCheckBoxHttpPart;
OMStackTraceFileCheckBoxHttpPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("text/plain"));
OMStackTraceFileCheckBoxHttpPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"openmodelica.stacktrace.OMEdit\"; filename=\"openmodelica.stacktrace.OMEdit\""));
QFile *pOMStackTraceFile = new QFile(mpOMStackTraceFileCheckBox->text());
pOMStackTraceFile->open(QIODevice::ReadOnly);
OMStackTraceFileCheckBoxHttpPart.setBodyDevice(pOMStackTraceFile);
pOMStackTraceFile->setParent(pHttpMultiPart); // file will be deleted when we delete pHttpMultiPart
pHttpMultiPart->append(OMStackTraceFileCheckBoxHttpPart);
}
// create the request
QUrl url("https://dev.openmodelica.org/omeditcrashreports/cgi-bin/server.py");
QNetworkRequest networkRequest(url);
QNetworkAccessManager *pNetworkAccessManager = new QNetworkAccessManager;
QNetworkReply *pNetworkReply = pNetworkAccessManager->post(networkRequest, pHttpMultiPart);
pNetworkReply->ignoreSslErrors();
pHttpMultiPart->setParent(pNetworkReply); // delete the pHttpMultiPart with the pNetworkReply
connect(pNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), SLOT(reportSent(QNetworkReply*)));
}
示例7: HandleSslErrors
void NetworkAccessManager::HandleSslErrors(const QList<QSslError> &errors){
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
if(!reply){
return;
}
Application::AskSslErrorPolicyIfNeed();
switch(Application::GetSslErrorPolicy()){
case Application::BlockAccess:
break;
case Application::IgnoreSslErrors:
reply->ignoreSslErrors();
break;
case Application::AskForEachAccess:{
ModalDialog *dialog = new ModalDialog();
dialog->SetTitle(tr("Ssl errors."));
dialog->SetCaption(tr("Ssl errors."));
dialog->SetInformativeText(tr("Ignore errors in this access?"));
QString detail;
foreach(QSslError error, errors){
if(!detail.isEmpty()) detail += QStringLiteral("\n");
detail += QStringLiteral("Ssl error : ") + error.errorString();
}
dialog->SetDetailedText(detail);
dialog->SetButtons(QStringList() << tr("Allow") << tr("Block"));
if(dialog->Execute() && dialog->ClickedButton() == tr("Allow"))
reply->ignoreSslErrors();
break;
}
case Application::AskForEachHost:
case Application::AskForEachCertificate:{
QString host = reply->url().host();
if(Application::GetBlockedHosts().contains(host)){
break;
} else if(Application::GetAllowedHosts().contains(host)){
reply->ignoreSslErrors();
break;
} else {
ModalDialog *dialog = new ModalDialog();
dialog->SetTitle(tr("Ssl errors on host:%1").arg(host));
dialog->SetCaption(tr("Ssl errors on host:%1").arg(host));
dialog->SetInformativeText(tr("Allow or Block this host?"));
QString detail;
foreach(QSslError error, errors){
if(!detail.isEmpty()) detail += QStringLiteral("\n");
detail += QStringLiteral("Ssl error : ") + error.errorString();
}
dialog->SetDetailedText(detail);
dialog->SetButtons(QStringList() << tr("Allow") << tr("Block") << tr("Cancel"));
dialog->Execute();
QString text = dialog->ClickedButton();
if(text == tr("Allow")){
Application::AppendToAllowedHosts(host);
reply->ignoreSslErrors();
} else if(text == tr("Block")){
Application::AppendToBlockedHosts(host);
}
break;
}
}
default: break;
}
}