Crash on initial load.

Fixes #20
This commit is contained in:
Robin Davies
2022-03-10 11:22:42 -05:00
parent 3737afb52b
commit 0319cc0588
7 changed files with 97 additions and 22 deletions
+9 -2
View File
@@ -385,11 +385,18 @@ namespace pipedal
}
std::shared_ptr<websocketpp::uri> connectionUri = con->get_uri();
uri requestUri(con->get_uri()->str().c_str());
HttpRequestImpl req(con->get_request());
HttpResponseImpl res((*con));
uri requestUri;
try {
requestUri.set(con->get_uri()->str().c_str());
} catch (const std::exception &e)
{
ServerError(*con, SS("Unexpected error. " << e.what()));
return;
}
if (req.method() == HttpVerb::options)
{
res.set(HttpField::access_control_allow_origin, origin);