| 135 | |
| 136 | namespace { |
| 137 | int websocketHandshake(const HttpHeader* header) |
| 138 | { |
| 139 | if (header->getMethod() != "GET" || |
| 140 | header->find(HttpHeader::SEC_WEBSOCKET_KEY).empty()) { |
| 141 | return 400; |
| 142 | } |
| 143 | else if (header->find(HttpHeader::SEC_WEBSOCKET_VERSION) != "13") { |
| 144 | return 426; |
| 145 | } |
| 146 | else if (header->getRequestPath() != "/jsonrpc") { |
| 147 | return 404; |
| 148 | } |
| 149 | else { |
| 150 | return 101; |
| 151 | } |
| 152 | } |
| 153 | } // namespace |
| 154 | |
| 155 | #endif // ENABLE_WEBSOCKET |