| 217 | } |
| 218 | |
| 219 | UInt8 HTTP::ParseConnection(Exception& ex,const char* value) { |
| 220 | UInt8 type(CONNECTION_ABSENT); |
| 221 | String::ForEach forEach([&type,&ex](UInt32 index,const char* field){ |
| 222 | if (String::ICompare(field, "upgrade") == 0) |
| 223 | type |= CONNECTION_UPGRADE; |
| 224 | else if (String::ICompare(field, "keep-alive") == 0) |
| 225 | type |= CONNECTION_KEEPALIVE; |
| 226 | else if (String::ICompare(field, "close") == 0) |
| 227 | type |= CONNECTION_CLOSE; |
| 228 | else if (String::ICompare(field, "update") == 0) |
| 229 | type |= CONNECTION_UPDATE; |
| 230 | else |
| 231 | ex.set(Exception::PROTOCOL, "Unknown HTTP type connection ", field); |
| 232 | return true; |
| 233 | }); |
| 234 | String::Split(value, ",", forEach, String::SPLIT_IGNORE_EMPTY | String::SPLIT_TRIM); |
| 235 | return type; |
| 236 | } |
| 237 | |
| 238 | |
| 239 | HTTP::ContentType HTTP::ParseContentType(const char* value, string& subType) { |