| 2594 | } |
| 2595 | |
| 2596 | std::size_t WebResponseCURL::CURLOnHeader(const char* buffer, std::size_t size) |
| 2597 | { |
| 2598 | StringView hdr = StringView(buffer, size).trimmed(); |
| 2599 | |
| 2600 | if (hdr.hasPrefix("HTTP/"_s)) { |
| 2601 | // First line of the headers contains status text after version and status |
| 2602 | hdr = hdr.suffix(hdr.findOr(' ', hdr.end()).begin()); |
| 2603 | _statusText = hdr.suffix(hdr.findOr(' ', hdr.end()).begin()); |
| 2604 | _headers.clear(); |
| 2605 | } else if (!hdr.empty()) { |
| 2606 | if (StringView sep = hdr.find(':')) { |
| 2607 | String hdrName = StringUtils::uppercase(hdr.prefix(sep.begin()).trimmedSuffix()); |
| 2608 | String hdrValue = hdr.suffix(sep.end()).trimmedPrefix(); |
| 2609 | _headers[hdrName].push_back(Death::move(hdrValue)); |
| 2610 | } |
| 2611 | } |
| 2612 | |
| 2613 | return size; |
| 2614 | } |
| 2615 | |
| 2616 | std::int32_t WebResponseCURL::CURLOnProgress(curl_off_t total) |
| 2617 | { |
no test coverage detected