| 178 | } |
| 179 | |
| 180 | std::string headerValue(const std::string& headers, const std::string& key) |
| 181 | { |
| 182 | std::string needle = key + ":"; |
| 183 | size_t pos = headers.find(needle); |
| 184 | if (pos == std::string::npos) { |
| 185 | return ""; |
| 186 | } |
| 187 | pos += needle.size(); |
| 188 | while (pos < headers.size() && (headers[pos] == ' ' || headers[pos] == '\t')) { |
| 189 | pos++; |
| 190 | } |
| 191 | size_t end = headers.find("\r\n", pos); |
| 192 | if (end == std::string::npos) { |
| 193 | end = headers.size(); |
| 194 | } |
| 195 | return headers.substr(pos, end - pos); |
| 196 | } |
| 197 | |
| 198 | bool constantTimeEquals(const std::string& a, const std::string& b) |
| 199 | { |
no test coverage detected