| 262 | } |
| 263 | |
| 264 | static int WebDebugDispatch(struct WebbyConnection *connection) |
| 265 | { |
| 266 | WebDebugConnection dbg_connection(connection); |
| 267 | |
| 268 | // Check dynamic handlers. |
| 269 | for (size_t i = 0; i < gHandlers.size(); ++i) |
| 270 | { |
| 271 | const WebDebugHandlerEntry & entry = gHandlers[i]; |
| 272 | if (strcmp(connection->request.uri, entry.Request) == 0) |
| 273 | { |
| 274 | entry.Handler(entry.Arg, &dbg_connection); |
| 275 | |
| 276 | DAEDALUS_ASSERT(dbg_connection.GetState() == WebDebugConnection::kResponded, "Failed to handle the response"); |
| 277 | |
| 278 | // Return success if we handled the connection. |
| 279 | return 0; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | // Check static resources. |
| 284 | if (ServeResource(&dbg_connection, connection->request.uri)) |
| 285 | return 0; |
| 286 | |
| 287 | DBGConsole_Msg(0, "404 [R%s]", connection->request.uri); |
| 288 | Generate404(&dbg_connection, connection->request.uri); |
| 289 | return 1; |
| 290 | } |
| 291 | |
| 292 | static int test_ws_connect(struct WebbyConnection *connection) |
| 293 | { |
nothing calls this directly
no test coverage detected