mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-10-31 04:50:34 -04:00 
			
		
		
		
	Make it possible to ignore SSL errors from network communications
It seems that the OpenSSL version on some systems is not capable of correctly handling intermediate certificates for some sites. These sites include SourceForge which we use for serving sample files. This change adds a global handler for QNAM SSL errors with the option to ignore them at the users discretion. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7359 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
		
							parent
							
								
									2255b17e91
								
							
						
					
					
						commit
						e61f5fa38f
					
				| @ -139,15 +139,6 @@ void RemoteFile::download (QUrl const& url) | |||||||
|                  listener_->download_progress (bytes_received, total_bytes); |                  listener_->download_progress (bytes_received, total_bytes); | ||||||
|                } |                } | ||||||
|            }); |            }); | ||||||
|   connect (reply_, &QNetworkReply::sslErrors, [this] (QList<QSslError> const& errors) { |  | ||||||
|       QString message; |  | ||||||
|       for (auto const& error: errors) |  | ||||||
|         { |  | ||||||
|           message += '\n' + reply_->request ().url ().toDisplayString () + ": " |  | ||||||
|             + error.errorString (); |  | ||||||
|         } |  | ||||||
|       listener_->error ("Network SSL Errors", message); |  | ||||||
|     }); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void RemoteFile::abort () | void RemoteFile::abort () | ||||||
|  | |||||||
							
								
								
									
										20
									
								
								main.cpp
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								main.cpp
									
									
									
									
									
								
							| @ -9,6 +9,7 @@ | |||||||
| #include <QDateTime> | #include <QDateTime> | ||||||
| #include <QApplication> | #include <QApplication> | ||||||
| #include <QNetworkAccessManager> | #include <QNetworkAccessManager> | ||||||
|  | #include <QNetworkReply> | ||||||
| #include <QRegularExpression> | #include <QRegularExpression> | ||||||
| #include <QObject> | #include <QObject> | ||||||
| #include <QSettings> | #include <QSettings> | ||||||
| @ -315,8 +316,25 @@ int main(int argc, char *argv[]) | |||||||
|                                                                   ).toBool () ? 1u : 4u; |                                                                   ).toBool () ? 1u : 4u; | ||||||
|           } |           } | ||||||
| 
 | 
 | ||||||
|  |           QNetworkAccessManager network_manager {&a}; | ||||||
|  | 
 | ||||||
|           // run the application UI
 |           // run the application UI
 | ||||||
|           MainWindow w(temp_dir, multiple, &multi_settings, &mem_jt9, downSampleFactor, new QNetworkAccessManager {&a}, &splash); |           MainWindow w(temp_dir, multiple, &multi_settings, &mem_jt9, downSampleFactor, &network_manager, &splash); | ||||||
|  | 
 | ||||||
|  |           // set up handling for any SSL issues
 | ||||||
|  |           QObject::connect (&network_manager, &QNetworkAccessManager::sslErrors, [&w] (QNetworkReply * reply, QList<QSslError> const& errors) { | ||||||
|  |               QString message; | ||||||
|  |               for (auto const& error: errors) | ||||||
|  |                 { | ||||||
|  |                   message += '\n' + reply->request ().url ().toDisplayString () + ": " | ||||||
|  |                     + error.errorString (); | ||||||
|  |                 } | ||||||
|  |               if (QMessageBox::Ignore == QMessageBox::question (&w, "Network SSL Errors", message, QMessageBox::Abort | QMessageBox::Ignore)) | ||||||
|  |                 { | ||||||
|  |                   reply->ignoreSslErrors (); | ||||||
|  |                 } | ||||||
|  |             }); | ||||||
|  | 
 | ||||||
|           w.show(); |           w.show(); | ||||||
|           splash.raise (); |           splash.raise (); | ||||||
|           QObject::connect (&a, SIGNAL (lastWindowClosed()), &a, SLOT (quit())); |           QObject::connect (&a, SIGNAL (lastWindowClosed()), &a, SLOT (quit())); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user