@@ -188,10 +188,11 @@ int DuckNet::setupWebServer(bool createCaptivePortal, std::string html) {
188188
189189 webServer.on (" /atakHistory" , HTTP_GET, [&](AsyncWebServerRequest* request){
190190 const uint8_t * atakBytes = DuckNet::serializeAtakHistoryToBytes (&atakBuffer);
191- size_t atakSize = 229 * CDPCFG_CDP_CHATBUF_SIZE;
191+ size_t atakSize = 229 * CDPCFG_CDP_CHATBUF_SIZE + 4 ;
192192 const char * atakType = " application/octet-stream" ;
193193 AsyncWebServerResponse *response = request->beginResponse_P (200 , atakType, atakBytes, atakSize);
194- delete[] atakBytes;
194+ request->send (response);
195+ delete[] atakBytes; // this needs to be fixed bc async
195196
196197 });
197198 webServer.on (" /atakChatHistory" , HTTP_GET, [&](AsyncWebServerRequest* request){
@@ -387,7 +388,7 @@ std::string DuckNet::serializeAtakHistoryToJSON(CircularBuffer* buffer) {
387388}
388389uint8_t * DuckNet::serializeAtakHistoryToBytes (CircularBuffer* buffer){
389390 int tail = buffer->getTail ();
390- uint8_t * atakBytes = new uint8_t [229 * CDPCFG_CDP_CHATBUF_SIZE];
391+ uint8_t * atakBytes = new uint8_t [229 * CDPCFG_CDP_CHATBUF_SIZE + 4 ];
391392 int offset = 0 ;
392393 while (tail != buffer->getHead ()){
393394 CdpPacket packet = buffer->getMessage (tail);
@@ -397,6 +398,7 @@ uint8_t* DuckNet::serializeAtakHistoryToBytes(CircularBuffer* buffer){
397398 if (tail == buffer->getBufferEnd ()){
398399 tail = 0 ;
399400 }
401+ atakBytes[offset++] = ' duck' ;
400402 }
401403 return atakBytes;
402404}
0 commit comments