| 57 | } |
| 58 | |
| 59 | static size_t write_data(char* ptr, size_t size, size_t nmemb, void* userdata) |
| 60 | { |
| 61 | if (!ptr) { |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | auto* const resp = static_cast<http::response*>(userdata); |
| 66 | assert(size == 1); |
| 67 | (void)size; // avoid warning in release builds |
| 68 | assert(resp); |
| 69 | resp->append_body(ptr, nmemb); |
| 70 | return nmemb; |
| 71 | } |
| 72 | |
| 73 | // std::isspace has a few edge cases that would trigger UB. In particular, the documentation says: |
| 74 | // "The behavior is undefined if the value of the input is not representable as unsigned char and is not equal to EOF." |
nothing calls this directly
no test coverage detected