--- a/src/HTTPHandler.h Thu Mar 24 02:02:48 2022 +0100
+++ b/src/HTTPHandler.h Thu Mar 24 02:19:39 2022 +0100
@@ -25,6 +25,7 @@
#include <stdexcept>
#include <curl/curl.h>
+#include <uuid/uuid.h>
#include <relpipe/common/type/typedefs.h>
#include <relpipe/reader/TypeId.h>
@@ -119,6 +120,15 @@
request.headers.push_back(convertor.to_bytes(value));
}
+ relpipe::common::type::StringX generateRequestId() {
+ char buffer[37];
+ uuid_t uuid;
+ uuid_generate_random(uuid);
+ // uuid_generate_time(uuid);
+ uuid_unparse_lower(uuid, buffer);
+ return convertor.from_bytes(buffer);
+ }
+
public:
HTTPHandler(shared_ptr<relpipe::writer::RelationalWriter> relationalWriter, Configuration configuration) : relationalWriter(relationalWriter), configuration(configuration) {
@@ -189,6 +199,8 @@
currentAttributeIndex = 0;
std::shared_ptr<HTTPClient> http(HTTPClient::open());
+ if (requestId.empty()) requestId = generateRequestId();
+
for (const HeaderDefinition& h : requestHeaders) if (h.matches(requestId, convertor.from_bytes(request.url))) appendRequestHeader(h.name, h.value);
std::string body;