diff options
| author | Dan Engelbrecht <[email protected]> | 2026-02-27 16:39:04 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-02-27 16:39:04 +0100 |
| commit | 87aff23c1246abd2838d8b0e589fe61015effa9c (patch) | |
| tree | 4ee3bd840d76278d51b82d19f7017c5a4867c5c0 /src/zenhttp/clients/httpclientcommon.cpp | |
| parent | MeasureLatency now bails out quickly if it experiences a connection error (#789) (diff) | |
| download | zen-87aff23c1246abd2838d8b0e589fe61015effa9c.tar.xz zen-87aff23c1246abd2838d8b0e589fe61015effa9c.zip | |
optimize string matching (#791)
Diffstat (limited to 'src/zenhttp/clients/httpclientcommon.cpp')
| -rw-r--r-- | src/zenhttp/clients/httpclientcommon.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/zenhttp/clients/httpclientcommon.cpp b/src/zenhttp/clients/httpclientcommon.cpp index 312ca16d2..c016e1c3c 100644 --- a/src/zenhttp/clients/httpclientcommon.cpp +++ b/src/zenhttp/clients/httpclientcommon.cpp @@ -425,12 +425,14 @@ namespace detail { return false; } - void MultipartBoundaryParser::InternalParseInput(std::string_view data) + void MultipartBoundaryParser::ParseInput(std::string_view data) { - size_t ScanPos = 0; - while (ScanPos < data.length()) + const char* InputPtr = data.data(); + size_t InputLength = data.length(); + size_t ScanPos = 0; + while (ScanPos < InputLength) { - const char ScanChar = data[ScanPos]; + const char ScanChar = InputPtr[ScanPos]; if (BoundaryBeginMatcher.MatchState == IncrementalStringMatcher::EMatchState::Complete) { if (PayloadOffset + ScanPos < (BoundaryBeginMatcher.GetMatchEndOffset() + BoundaryEndMatcher.GetMatchString().length())) @@ -504,7 +506,7 @@ namespace detail { } ScanPos++; } - PayloadOffset += data.length(); + PayloadOffset += InputLength; } std::pair<std::string_view, std::string_view> GetHeaderKeyAndValue(std::string_view HeaderString) |