| 165 | } |
| 166 | |
| 167 | size_t parseContentLength(const std::string& headers) |
| 168 | { |
| 169 | // headerValue is case-insensitive, so every spelling a client may send is |
| 170 | // covered without listing them here. |
| 171 | std::string value = TransferProto::headerValue(headers, "Content-Length"); |
| 172 | if (value.empty()) { |
| 173 | return 0; |
| 174 | } |
| 175 | return (size_t)strtoul(value.c_str(), nullptr, 10); |
| 176 | } |
| 177 | |
| 178 | // Streams the body of an upload request to `tmpPath`, tracking progress and |
| 179 | // honouring a receive cancel. `leftover` is the body bytes already read while |
no test coverage detected