src/HTTPDHandler.h
branchv_0
changeset 8 90990c8b6aef
parent 7 315d985f8424
--- a/src/HTTPDHandler.h	Thu Apr 21 00:43:54 2022 +0200
+++ b/src/HTTPDHandler.h	Sat Apr 30 02:49:50 2022 +0200
@@ -163,7 +163,32 @@
 				{L"value", relpipe::writer::TypeId::STRING},
 			}, true);
 
-			for (const HTTPServer::Header& h : request.header) {
+			for (const HTTPServer::AVP& h : request.header) {
+				relationalWriter->writeAttribute(exchangeId);
+				relationalWriter->writeAttribute(convertor.from_bytes(request.url));
+				relationalWriter->writeAttribute(L"request");
+				relationalWriter->writeAttribute(convertor.from_bytes(h.name));
+				relationalWriter->writeAttribute(convertor.from_bytes(h.value));
+			}
+
+			for (const HTTPServer::AVP& h : response.header) {
+				relationalWriter->writeAttribute(exchangeId);
+				relationalWriter->writeAttribute(convertor.from_bytes(request.url));
+				relationalWriter->writeAttribute(L"response");
+				relationalWriter->writeAttribute(convertor.from_bytes(h.name));
+				relationalWriter->writeAttribute(convertor.from_bytes(h.value));
+			}
+			
+			relationalWriter->startRelation(L"cookie",{
+				// TODO: ordinal number?
+				{L"exchange", relpipe::writer::TypeId::STRING},
+				{L"url", relpipe::writer::TypeId::STRING},
+				{L"direction", relpipe::writer::TypeId::STRING},
+				{L"name", relpipe::writer::TypeId::STRING},
+				{L"value", relpipe::writer::TypeId::STRING},
+			}, true);
+			
+			for (const HTTPServer::AVP& h : request.cookie) {
 				relationalWriter->writeAttribute(exchangeId);
 				relationalWriter->writeAttribute(convertor.from_bytes(request.url));
 				relationalWriter->writeAttribute(L"request");
@@ -171,13 +196,43 @@
 				relationalWriter->writeAttribute(convertor.from_bytes(h.value));
 			}
 
-			for (const HTTPServer::Header& h : response.header) {
+			for (const HTTPServer::AVP& h : response.cookie) {
 				relationalWriter->writeAttribute(exchangeId);
 				relationalWriter->writeAttribute(convertor.from_bytes(request.url));
 				relationalWriter->writeAttribute(L"response");
 				relationalWriter->writeAttribute(convertor.from_bytes(h.name));
 				relationalWriter->writeAttribute(convertor.from_bytes(h.value));
 			}
+			
+			relationalWriter->startRelation(L"get_parameter",{
+				// TODO: ordinal number?
+				{L"exchange", relpipe::writer::TypeId::STRING},
+				{L"url", relpipe::writer::TypeId::STRING},
+				{L"name", relpipe::writer::TypeId::STRING},
+				{L"value", relpipe::writer::TypeId::STRING},
+			}, true);
+			
+			for (const HTTPServer::AVP& h : request.getParameter) {
+				relationalWriter->writeAttribute(exchangeId);
+				relationalWriter->writeAttribute(convertor.from_bytes(request.url));
+				relationalWriter->writeAttribute(convertor.from_bytes(h.name));
+				relationalWriter->writeAttribute(convertor.from_bytes(h.value));
+			}
+			
+			relationalWriter->startRelation(L"post_parameter",{
+				// TODO: ordinal number?
+				{L"exchange", relpipe::writer::TypeId::STRING},
+				{L"url", relpipe::writer::TypeId::STRING},
+				{L"name", relpipe::writer::TypeId::STRING},
+				{L"value", relpipe::writer::TypeId::STRING},
+			}, true);
+			
+			for (const HTTPServer::AVP& h : request.postParameter) {
+				relationalWriter->writeAttribute(exchangeId);
+				relationalWriter->writeAttribute(convertor.from_bytes(request.url));
+				relationalWriter->writeAttribute(convertor.from_bytes(h.name));
+				relationalWriter->writeAttribute(convertor.from_bytes(h.value));
+			}
 
 
 
@@ -212,8 +267,8 @@
 					response.code = t.code;
 					response.body = t.body;
 					// TODO: replace global header values with request-specific ones instead of appending?
-					for (const GlobalHeaderTemplate& h : *headerTemplates) if (h.matches(request.method, request.url)) response.header.push_back(HTTPServer::Header(h.name, h.value));
-					for (const HeaderTemplate& h : t.headers) response.header.push_back(HTTPServer::Header(h.name, h.value));
+					for (const GlobalHeaderTemplate& h : *headerTemplates) if (h.matches(request.method, request.url)) response.header.push_back({h.name, h.value});
+					for (const HeaderTemplate& h : t.headers) response.header.push_back({h.name, h.value});
 					break;
 				}
 			}