MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / scHttpWebSocketTrim

Function scHttpWebSocketTrim

Libraries/Http/HttpWebSocket.cpp:93–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91static bool scHttpWebSocketIsSpace(char value) { return value == ' ' or value == '\t'; }
92
93static SC::StringSpan scHttpWebSocketTrim(SC::StringSpan value)
94{
95 const char* start = value.bytesWithoutTerminator();
96 const char* end = start + value.sizeInBytes();
97 while (start < end and scHttpWebSocketIsSpace(*start))
98 {
99 start++;
100 }
101 while (end > start and scHttpWebSocketIsSpace(*(end - 1)))
102 {
103 end--;
104 }
105 return {{start, static_cast<size_t>(end - start)}, false, value.getEncoding()};
106}
107
108static SC::Result scHttpWebSocketBase64Encode(SC::Span<const uint8_t> data, SC::Span<char> storage,
109 SC::StringSpan& output)

Callers 3

headerContainsTokenMethod · 0.85
validateServerRequestMethod · 0.85

Calls 2

scHttpWebSocketIsSpaceFunction · 0.85
sizeInBytesMethod · 0.45

Tested by

no test coverage detected