# HG changeset patch # User František Kučera # Date 1650493388 -7200 # Node ID b04bde9083d474846be5d28d2ea83e483a89aea8 # Parent 121981e6bd54c0f92726f9b3c5ded8a35677be5f add request and response sizes diff -r 121981e6bd54 -r b04bde9083d4 src/HTTPDHandler.h --- a/src/HTTPDHandler.h Sat Apr 16 02:43:50 2022 +0200 +++ b/src/HTTPDHandler.h Thu Apr 21 00:23:08 2022 +0200 @@ -53,7 +53,6 @@ std::shared_ptr httpServer; relpipe::common::type::StringX currentRelationName; std::vector currentReaderMetadata; - std::vector currentWriterMetadata; size_t currentAttributeIndex = 0; size_t currentRecordNumber = 1; @@ -113,7 +112,7 @@ void writeExchange(const HTTPServer::Request& request, const HTTPServer::Response& response) { std::wstring_convert < codecvt_utf8> convertor; // TODO: support also other encoding than UTF-8 std::lock_guard lock(*relationalWriterMutex); - + auto exchangeId = convertor.from_bytes(generateExchangeId()); @@ -125,27 +124,37 @@ // TODO: support multiple encodings relationalWriter->startRelation(L"exchange",{ + // TODO: timestamp + // TODO: ordinal number? {L"id", relpipe::writer::TypeId::STRING}, {L"url", relpipe::writer::TypeId::STRING}, {L"method", relpipe::writer::TypeId::STRING}, {L"request_text", relpipe::writer::TypeId::STRING}, {L"request_data", relpipe::writer::TypeId::STRING}, + {L"request_size", relpipe::writer::TypeId::INTEGER}, {L"response_text", relpipe::writer::TypeId::STRING}, {L"response_data", relpipe::writer::TypeId::STRING}, + {L"response_size", relpipe::writer::TypeId::INTEGER}, {L"response_code", relpipe::writer::TypeId::INTEGER}, }, true); + relpipe::common::type::Integer requestSize = request.body.size(); + relpipe::common::type::Integer responseSize = response.body.size(); + relationalWriter->writeAttribute(exchangeId); relationalWriter->writeAttribute(convertor.from_bytes(request.url)); relationalWriter->writeAttribute(convertor.from_bytes(request.method)); relationalWriter->writeAttribute(bodyToText(convertor, request.body)); relationalWriter->writeAttribute(bodyToHex(convertor, request.body)); + relationalWriter->writeAttribute(&requestSize, typeid (requestSize)); relationalWriter->writeAttribute(bodyToText(convertor, response.body)); relationalWriter->writeAttribute(bodyToHex(convertor, response.body)); + relationalWriter->writeAttribute(&responseSize, typeid (responseSize)); relationalWriter->writeAttribute(std::to_wstring(response.code)); relationalWriter->startRelation(L"header",{ + // TODO: ordinal number? {L"exchange", relpipe::writer::TypeId::STRING}, {L"url", relpipe::writer::TypeId::STRING}, {L"direction", relpipe::writer::TypeId::STRING},