From e423556af25c97760322ca173cb989efdc4ba55a Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Fri, 24 May 2024 11:08:26 +0200 Subject: [PATCH] Fix more ops --- src/AppWrapper.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/AppWrapper.h b/src/AppWrapper.h index 30f4a5ff..e5c802c7 100644 --- a/src/AppWrapper.h +++ b/src/AppWrapper.h @@ -339,16 +339,16 @@ void uWS_App_get(F f, const FunctionCallbackInfo &args) { break; case 1: { /* opCode WRITE_HEADER */ - uint16_t keyLength; - memcpy(&keyLength, remainingInstructions.data() + 1, 2); - remainingInstructions.remove_prefix(3); // Skip opCode and key length bytes + uint8_t keyLength; + memcpy(&keyLength, remainingInstructions.data() + 1, 1); + remainingInstructions.remove_prefix(2); // Skip opCode and key length bytes std::string_view keyString(remainingInstructions.data(), keyLength); remainingInstructions.remove_prefix(keyLength); - uint16_t valueLength; - memcpy(&valueLength, remainingInstructions.data(), 2); - remainingInstructions.remove_prefix(2); // Skip value length bytes + uint8_t valueLength; + memcpy(&valueLength, remainingInstructions.data(), 1); + remainingInstructions.remove_prefix(1); // Skip value length bytes std::string_view valueString(remainingInstructions.data(), valueLength); remainingInstructions.remove_prefix(valueLength); @@ -364,26 +364,26 @@ void uWS_App_get(F f, const FunctionCallbackInfo &args) { break; case 3: { /* opCode WRITE_QUERY_VALUE */ - uint16_t keyLength; - memcpy(&keyLength, remainingInstructions.data() + 1, 2); - remainingInstructions.remove_prefix(3); // Skip opCode and key length bytes + uint8_t keyLength; + memcpy(&keyLength, remainingInstructions.data() + 1, 1); + remainingInstructions.remove_prefix(2); // Skip opCode and key length bytes std::string_view keyString(remainingInstructions.data(), keyLength); remainingInstructions.remove_prefix(keyLength); - //res->writeQueryValue(keyString); + res->write(req->getQuery(keyString)); } break; case 4: { /* opCode WRITE_HEADER_VALUE */ - uint16_t keyLength; - memcpy(&keyLength, remainingInstructions.data() + 1, 2); - remainingInstructions.remove_prefix(3); // Skip opCode and key length bytes + uint8_t keyLength; + memcpy(&keyLength, remainingInstructions.data() + 1, 1); + remainingInstructions.remove_prefix(2); // Skip opCode and key length bytes std::string_view keyString(remainingInstructions.data(), keyLength); remainingInstructions.remove_prefix(keyLength); - //res->writeHeaderValue(keyString); + res->write(req->getHeader(keyString)); } break; case 5: { @@ -400,14 +400,14 @@ void uWS_App_get(F f, const FunctionCallbackInfo &args) { break; case 6: { /* opCode WRITE_PARAMETER_VALUE */ - uint16_t keyLength; - memcpy(&keyLength, remainingInstructions.data() + 1, 2); - remainingInstructions.remove_prefix(3); // Skip opCode and key length bytes + uint8_t keyLength; + memcpy(&keyLength, remainingInstructions.data() + 1, 1); + remainingInstructions.remove_prefix(2); // Skip opCode and key length bytes std::string_view keyString(remainingInstructions.data(), keyLength); remainingInstructions.remove_prefix(keyLength); - //res->writeParameterValue(keyString); + res->write(req->getParameter(keyString)); } break; }