From 88b2439debe040f3e65b36b336b2f4dd35ae75c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= Date: Sat, 14 Nov 2020 18:07:05 -0500 Subject: [PATCH] http: use string for body, fix log arguments --- src/http.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/http.cpp b/src/http.cpp index 05550eed..adb6bed8 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -107,22 +107,22 @@ newTlsClientContext(const std::shared_ptr& logger) if (char* path = getenv("CA_ROOT_FILE")) { if (logger) - logger->d("[connection:%i] using CA file: %s", path); + logger->d("Using CA file: %s", path); ctx->load_verify_file(path); } else if (char* path = getenv("CA_ROOT_PATH")) { if (logger) - logger->d("[connection:%i] using CA path: %s", path); + logger->d("Using CA path: %s", path); ctx->add_verify_path(path); } else { #ifdef __ANDROID__ if (logger) - logger->d("[connection:%i] using CA path: /system/etc/security/cacerts"); + logger->d("Using CA path: /system/etc/security/cacerts"); ctx->add_verify_path("/system/etc/security/cacerts"); #elif defined(WIN32) || defined(__APPLE__) PEMCache::instance(logger).fillX509Store(ctx->native_handle()); #else if (logger) - logger->d("[connection:%i] using default CA path"); + logger->d("Using default CA path"); ctx->set_default_verify_paths(); #endif } @@ -254,7 +254,7 @@ issuer_from_chain(STACK_OF(X509)* fullchain) using OscpRequestPtr = std::unique_ptr; struct OscpRequestInfo { OscpRequestPtr req {nullptr, &OCSP_REQUEST_free}; - std::vector data; + std::string data; std::string url; }; @@ -324,7 +324,7 @@ ocspRequestFromCert(STACK_OF(X509)* fullchain, const std::shared_ptr& lo logger->e("Unable to allocte memory"); return {}; } - request->data = std::vector(data, data+size); + request->data = std::string((char*)data, (char*)data+size); free(data); return request; } @@ -504,7 +504,7 @@ Connection::set_ssl_verification(const std::string& hostname, const asio::ssl::v }, logger); ocspReq->set_method(restinio::http_method_post()); ocspReq->set_header_field(restinio::http_field_t::content_type, "application/ocsp-request"); - ocspReq->set_body({ocspInfo->data.begin(), ocspInfo->data.end()}); + ocspReq->set_body(ocspInfo->data); ocspReq->send(); io_ctx.run(); if (not ocspVerified)