From 047240f4e514b8a1b6a6fef29d4c982dff8e583e Mon Sep 17 00:00:00 2001 From: PEPSIMANTR Date: Sun, 18 Feb 2024 16:04:08 +0300 Subject: [PATCH] 2.5.2 --- Alyssa.rc | 8 ++++---- CHANGELOG.md | 4 ++++ src/Alyssa.h | 4 ++-- src/AlyssaH2.h | 4 ++-- src/AlyssaHTTP.cpp | 6 +++--- src/AlyssaLogging.cpp | 5 +++-- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Alyssa.rc b/Alyssa.rc index a42be20..255c869 100644 --- a/Alyssa.rc +++ b/Alyssa.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,5,1,0 - PRODUCTVERSION 2,5,1,0 + FILEVERSION 2,5,2,0 + PRODUCTVERSION 2,5,2,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -69,12 +69,12 @@ BEGIN BEGIN VALUE "CompanyName", "Alyssa Software" VALUE "FileDescription", "Alyssa HTTP Server Project" - VALUE "FileVersion", "2.5.1" + VALUE "FileVersion", "2.5.2" VALUE "InternalName", "AlyssaHTTP.exe" VALUE "LegalCopyright", "Copyright (C) 2024 Alyssa Software - GPLv3 Licensed" VALUE "OriginalFilename", "AlyssaHTTP.exe" VALUE "ProductName", "Alyssa HTTP Server Project" - VALUE "ProductVersion", "2.5.1" + VALUE "ProductVersion", "2.5.2" END END BLOCK "VarFileInfo" diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e3d913..abc1275 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Alyssa HTTP Server Changelog +## 2.5.2 - 18.02.2024 +- Potential fix to crash caused by SSL on some requests +- Connections with SSL now will be logged as '(SSL)' on log file. + ## 2.5.1 - 16.02.2024 - Fixed the integer overflow on code that causes infinite loop, and eventually using all of CPU - Problem was happening with long requests. Now limit of request paths are increased to 32768 bytes diff --git a/src/Alyssa.h b/src/Alyssa.h index 09998f4..cf48a40 100644 --- a/src/Alyssa.h +++ b/src/Alyssa.h @@ -379,9 +379,9 @@ static const char* MsgTypeStr[] = { "Error: ","Warning: ","Info: " }; #endif #else #ifdef _DEBUG - static std::string version = "2.5.1d"; + static std::string version = "2.5.2d"; #else - static std::string version = "2.5.1"; + static std::string version = "2.5.2"; #endif #endif #ifdef _WIN32 diff --git a/src/AlyssaH2.h b/src/AlyssaH2.h index 31c5224..91d88ad 100644 --- a/src/AlyssaH2.h +++ b/src/AlyssaH2.h @@ -112,7 +112,7 @@ class AlyssaHTTP2 { } static void Get(H2Stream* s); static bool __AlyssaH2ParsePath(H2Stream* s, std::string& Value) { - uint8_t pos = -1; + uint16_t pos = -1; // Decode percents pos = Value.size(); for (char t = 0; t < pos; t++) { @@ -129,7 +129,7 @@ class AlyssaHTTP2 { Value.resize(pos); // Query string pos = Value.find('?'); - if (pos != 255) { + if (pos != 65535) { unsigned char _sz = Value.size(); s->cl.qStr.resize(_sz - pos); memcpy(s->cl.qStr.data(), &Value[pos + 1], _sz - pos - 1); Value.resize(pos); diff --git a/src/AlyssaHTTP.cpp b/src/AlyssaHTTP.cpp index 2bddb18..04bfeba 100644 --- a/src/AlyssaHTTP.cpp +++ b/src/AlyssaHTTP.cpp @@ -256,8 +256,8 @@ int8_t AlyssaHTTP::parseHeader(clientInfo* cl, char* buf, int sz) { ServerHeadersM(cl, 403); return -3; } else if (VirtualHosts[i].Type == 3) { // "Hang-up" virtual host - closesocket(cl->Sr->sock); - if (logging) AlyssaLogging::literal(cl->Sr->clhostname + " -> " + VirtualHosts[i].Hostname + cl->RequestPath + " rejected and hung-up.", 'C'); + shutdown(cl->Sr->sock, 2); + if (logging) AlyssaLogging::literal(((cl->Sr->ssl) ? "(SSL)" : "") + cl->Sr->clhostname + " -> " + VirtualHosts[i].Hostname + cl->RequestPath + " rejected and hung-up.", 'C'); return -3;// No clean shutdown or anything, we just say fuck off to client. } break; @@ -274,7 +274,7 @@ int8_t AlyssaHTTP::parseHeader(clientInfo* cl, char* buf, int sz) { ServerHeadersM(cl, 403); return -3; } else if (VirtualHosts[0].Type == 3) { - closesocket(cl->Sr->sock); + shutdown(cl->Sr->sock, 2); if (logging) AlyssaLogging::literal(cl->Sr->clhostname + " -> " + cl->host + cl->RequestPath + " rejected and hung-up.", 'C'); return -3; } diff --git a/src/AlyssaLogging.cpp b/src/AlyssaLogging.cpp index e6f820e..1a39612 100644 --- a/src/AlyssaLogging.cpp +++ b/src/AlyssaLogging.cpp @@ -6,8 +6,9 @@ namespace AlyssaLogging { std::terminate(); } logMutex.lock(); - Log << "C [" << currentTime() << "] (" << statusCode << ") " - << cl->Sr->clhostname << " -> "<< cl->host << cl->RequestPath + Log << "C [" << currentTime() << "] (" << statusCode << + ((cl->Sr->ssl) ? ") (SSL) '" : ") '") + << cl->Sr->clhostname << "' -> "<< cl->host << cl->RequestPath << std::endl; logMutex.unlock(); }