| 181 | } |
| 182 | |
| 183 | std::string StringConverter::getMethod(const std::string &msg) { |
| 184 | // request line should be in the first line (method) |
| 185 | std::string::size_type nextline = 0; |
| 186 | const std::string line = StringConverter::getline(msg, nextline, "\r\n"); |
| 187 | if (!line.empty()) { |
| 188 | std::string::const_iterator it = line.begin(); |
| 189 | // remove any leading whitespace |
| 190 | while (*it == ' ') ++it; |
| 191 | |
| 192 | // copy method (upper case) |
| 193 | std::string method; |
| 194 | while (*it != ' ') { |
| 195 | method += std::toupper(*it); |
| 196 | ++it; |
| 197 | } |
| 198 | return method; |
| 199 | } |
| 200 | return ""; |
| 201 | } |
| 202 | |
| 203 | std::string StringConverter::getContentFrom(const std::string &msg) { |
| 204 | const std::string parameter = StringConverter::getHeaderFieldParameter(msg, "Content-Length:"); |
nothing calls this directly
no outgoing calls
no test coverage detected