| 3951 | } |
| 3952 | |
| 3953 | inline bool parse_multipart_boundary(const std::string &content_type, |
| 3954 | std::string &boundary) { |
| 3955 | auto boundary_keyword = "boundary="; |
| 3956 | auto pos = content_type.find(boundary_keyword); |
| 3957 | if (pos == std::string::npos) { return false; } |
| 3958 | auto end = content_type.find(';', pos); |
| 3959 | auto beg = pos + strlen(boundary_keyword); |
| 3960 | boundary = content_type.substr(beg, end - beg); |
| 3961 | if (boundary.length() >= 2 && boundary.front() == '"' && |
| 3962 | boundary.back() == '"') { |
| 3963 | boundary = boundary.substr(1, boundary.size() - 2); |
| 3964 | } |
| 3965 | return !boundary.empty(); |
| 3966 | } |
| 3967 | |
| 3968 | #ifdef CPPHTTPLIB_NO_EXCEPTIONS |
| 3969 | inline bool parse_range_header(const std::string &s, Ranges &ranges) { |