| 1184 | } |
| 1185 | |
| 1186 | unsigned char* http_header::create_ws_key(const void* key, size_t len) const |
| 1187 | { |
| 1188 | string tmp(key, len); |
| 1189 | tmp += "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; |
| 1190 | |
| 1191 | sha1 sha; |
| 1192 | sha.input(tmp.c_str(), (unsigned int) tmp.size()); |
| 1193 | unsigned char digest[20]; |
| 1194 | sha.result2((unsigned*) digest); |
| 1195 | //sha.result((unsigned char*) digest); |
| 1196 | |
| 1197 | //little endian to big endian |
| 1198 | for (int i = 0; i < 20; i += 4) { |
| 1199 | unsigned char c; |
| 1200 | |
| 1201 | c = digest[i]; |
| 1202 | digest[i] = digest[i + 3]; |
| 1203 | digest[i + 3] = c; |
| 1204 | |
| 1205 | c = digest[i + 1]; |
| 1206 | digest[i + 1] = digest[i + 2]; |
| 1207 | digest[i + 2] = c; |
| 1208 | } |
| 1209 | |
| 1210 | unsigned char* s = acl_base64_encode((char*) digest, 20); |
| 1211 | return s; |
| 1212 | } |
| 1213 | |
| 1214 | bool http_header::build_response(string& out) const |
| 1215 | { |
nothing calls this directly
no test coverage detected