Skip to content
Snippets Groups Projects
Commit cca23a89 authored by Odilitime's avatar Odilitime
Browse files
parents f8e31b05 585dee2c
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ bool HTTPSRequest::sendRequest(std::function<void(const HTTPResponse&)> response
mbedtls_ssl_conf_authmode(&conf, MBEDTLS_SSL_VERIFY_REQUIRED);
mbedtls_ssl_conf_rng(&conf, mbedtls_ctr_drbg_random, &ctr_drbg);
mbedtls_ssl_conf_ca_chain( &conf, &cacert, NULL );
mbedtls_ssl_conf_ca_chain( &conf, &cacert, nullptr );
if( mbedtls_ssl_setup( &ssl, &conf ) != 0 )
{
......@@ -56,7 +56,7 @@ bool HTTPSRequest::sendRequest(std::function<void(const HTTPResponse&)> response
return false;
}
mbedtls_ssl_set_bio( &ssl, &server_fd, mbedtls_net_send, mbedtls_net_recv, NULL );
mbedtls_ssl_set_bio( &ssl, &server_fd, mbedtls_net_send, mbedtls_net_recv, nullptr );
int state = mbedtls_ssl_handshake( &ssl );
while(state != 0)
......@@ -76,7 +76,7 @@ bool HTTPSRequest::sendRequest(std::function<void(const HTTPResponse&)> response
const std::string request = methodToString(method) + std::string(" ") + document + std::string(" ") + versionToString(version) + std::string("\r\nHost: ") + host + std::string("\r\nUser-Agent: ") + userAgent + std::string("\r\n\r\n");
while( ( state = mbedtls_ssl_write( &ssl, (const unsigned char*)request.c_str(), request.length() ) ) <= 0 )
while( ( state = mbedtls_ssl_write( &ssl, reinterpret_cast<const unsigned char*>(request.c_str()), request.length() ) ) <= 0 )
{
if( state != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE )
{
......@@ -87,7 +87,7 @@ bool HTTPSRequest::sendRequest(std::function<void(const HTTPResponse&)> response
do
{
ret = mbedtls_ssl_read( &ssl, (unsigned char*)buffer, 512 );
ret = mbedtls_ssl_read( &ssl, reinterpret_cast<unsigned char *>(buffer), 512 );
if (ret <= 0)
break;
else
......@@ -137,7 +137,7 @@ bool HTTPSRequest::initTLS()
const char *seed = "netrunner_ssl_seed$%?rvx86_despair^^%$#@";
mbedtls_entropy_init( &entropy );
if(mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, (const unsigned char*)seed, strlen(seed) ) != 0 )
if(mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, reinterpret_cast<const unsigned char*>(seed), strlen(seed) ) != 0 )
{
return false;
}
......@@ -149,4 +149,4 @@ bool HTTPSRequest::initTLS()
return false;
}
return true;
}
\ No newline at end of file
}
......@@ -2,7 +2,7 @@
#define HTTPSREQUEST_H
#include "HTTPCommon.h"
#include "httpResponse.h"
#include "HTTPResponse.h"
#include "../URL.h"
#include <functional>
#include <string>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment