mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-11-03 23:28:48 +00:00 
			
		
		
		
	externals: update httplib and libressl ...
* In older `httplib`, SSL connections were not handled correctly and will have issues with proxy servers. Also, keep alive directives were not available back then, which is probably necessary to implement HTTP_C service correctly. * Another reason being `httplib` now requires OpenSSL 1.1+ API while LibreSSL 2.x provided OpenSSL 1.0 compatible API. * The bundled LibreSSL has been updated to 3.2.2 so it now provides OpenSSL 1.1 compatible API now. * Also the path hint has been added so that it will find the correct path to the CA certs on *nix systems. * An option is provided so that *nix system distributions/providers can use their own SSL implementations when compiling Yuzu/Citra to (hopefully) complies with their maintenance guidelines. * LURLParse is also removed since `httplib` can handle `scheme:host:port` string itself now.
This commit is contained in:
		
							parent
							
								
									45a4a56264
								
							
						
					
					
						commit
						af24f75c18
					
				
					 12 changed files with 4436 additions and 2124 deletions
				
			
		| 
						 | 
				
			
			@ -3,9 +3,6 @@
 | 
			
		|||
// Refer to the license.txt file included.
 | 
			
		||||
 | 
			
		||||
#include <atomic>
 | 
			
		||||
#ifdef ENABLE_WEB_SERVICE
 | 
			
		||||
#include <LUrlParser.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <cryptopp/aes.h>
 | 
			
		||||
#include <cryptopp/modes.h>
 | 
			
		||||
#include "common/archives.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -61,27 +58,9 @@ void Context::MakeRequest() {
 | 
			
		|||
    ASSERT(state == RequestState::NotStarted);
 | 
			
		||||
 | 
			
		||||
#ifdef ENABLE_WEB_SERVICE
 | 
			
		||||
    LUrlParser::clParseURL parsedUrl = LUrlParser::clParseURL::ParseURL(url);
 | 
			
		||||
    int port;
 | 
			
		||||
    std::unique_ptr<httplib::Client> client;
 | 
			
		||||
    if (parsedUrl.m_Scheme == "http") {
 | 
			
		||||
        if (!parsedUrl.GetPort(&port)) {
 | 
			
		||||
            port = 80;
 | 
			
		||||
        }
 | 
			
		||||
        // TODO(B3N30): Support for setting timeout
 | 
			
		||||
        // Figure out what the default timeout on 3DS is
 | 
			
		||||
        client = std::make_unique<httplib::Client>(parsedUrl.m_Host.c_str(), port);
 | 
			
		||||
    } else {
 | 
			
		||||
        if (!parsedUrl.GetPort(&port)) {
 | 
			
		||||
            port = 443;
 | 
			
		||||
        }
 | 
			
		||||
        // TODO(B3N30): Support for setting timeout
 | 
			
		||||
        // Figure out what the default timeout on 3DS is
 | 
			
		||||
 | 
			
		||||
        auto ssl_client = std::make_unique<httplib::SSLClient>(parsedUrl.m_Host, port);
 | 
			
		||||
        SSL_CTX* ctx = ssl_client->ssl_context();
 | 
			
		||||
        client = std::move(ssl_client);
 | 
			
		||||
 | 
			
		||||
    std::unique_ptr<httplib::Client> client = std::make_unique<httplib::Client>(url.c_str());
 | 
			
		||||
    SSL_CTX* ctx = client->ssl_context();
 | 
			
		||||
    if (ctx) {
 | 
			
		||||
        if (auto client_cert = ssl_config.client_cert_ctx.lock()) {
 | 
			
		||||
            SSL_CTX_use_certificate_ASN1(ctx, static_cast<int>(client_cert->certificate.size()),
 | 
			
		||||
                                         client_cert->certificate.data());
 | 
			
		||||
| 
						 | 
				
			
			@ -105,6 +84,7 @@ void Context::MakeRequest() {
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    httplib::Request request;
 | 
			
		||||
    httplib::Error error;
 | 
			
		||||
    request.method = request_method_strings.at(method);
 | 
			
		||||
    request.path = url;
 | 
			
		||||
    // TODO(B3N30): Add post data body
 | 
			
		||||
| 
						 | 
				
			
			@ -119,8 +99,8 @@ void Context::MakeRequest() {
 | 
			
		|||
        request.headers.emplace(header.name, header.value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!client->send(request, response)) {
 | 
			
		||||
        LOG_ERROR(Service_HTTP, "Request failed");
 | 
			
		||||
    if (!client->send(request, response, error)) {
 | 
			
		||||
        LOG_ERROR(Service_HTTP, "Request failed: {}", error);
 | 
			
		||||
        state = RequestState::TimedOut;
 | 
			
		||||
    } else {
 | 
			
		||||
        LOG_DEBUG(Service_HTTP, "Request successful");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue