mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Fix several minor issues on the seclang grammar
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "modsecurity/modsecurity.h"
|
||||
#include "src/unique_id.h"
|
||||
|
||||
namespace ModSecurity {
|
||||
@@ -45,12 +46,16 @@ size_t HttpsClient::handle_impl(char* data, size_t size, size_t nmemb) {
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
void HttpsClient::setKey(const std::string& key) {
|
||||
m_key = "ModSec-key: " + key;
|
||||
}
|
||||
|
||||
#ifdef MSC_WITH_CURL
|
||||
bool HttpsClient::download(const std::string &uri) {
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
std::string uniqueId = "ModSec-unique-id: " + UniqueId::uniqueId();
|
||||
std::string status = "ModSec-status: " MODSECURITY_VERSION_NUM;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if (!curl) {
|
||||
@@ -62,6 +67,10 @@ bool HttpsClient::download(const std::string &uri) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, uri.c_str());
|
||||
|
||||
headers_chunk = curl_slist_append(headers_chunk, uniqueId.c_str());
|
||||
headers_chunk = curl_slist_append(headers_chunk, status.c_str());
|
||||
if (m_key.empty() == false) {
|
||||
headers_chunk = curl_slist_append(headers_chunk, m_key.c_str());
|
||||
}
|
||||
|
||||
/* Make it TLS 1.x only. */
|
||||
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
|
||||
|
@@ -37,15 +37,19 @@ class HttpsClient {
|
||||
public:
|
||||
HttpsClient()
|
||||
: content(""),
|
||||
error("") { }
|
||||
error(""),
|
||||
m_key("") { }
|
||||
|
||||
bool download(const std::string &uri);
|
||||
std::string content;
|
||||
|
||||
static size_t handle(char * data, size_t size, size_t nmemb, void * p);
|
||||
size_t handle_impl(char * data, size_t size, size_t nmemb);
|
||||
void setKey(const std::string& key);
|
||||
|
||||
std::string error;
|
||||
private:
|
||||
std::string m_key;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user