aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--amalgamate/crow_all.h1
-rw-r--r--examples/websocket/example_ws.cpp7
-rw-r--r--examples/websocket/templates/ws.html2
-rw-r--r--include/crow/http_connection.h1
4 files changed, 9 insertions, 2 deletions
diff --git a/amalgamate/crow_all.h b/amalgamate/crow_all.h
index 41b06ff..bc23f58 100644
--- a/amalgamate/crow_all.h
+++ b/amalgamate/crow_all.h
@@ -8893,6 +8893,7 @@ namespace crow
{401, "HTTP/1.1 401 Unauthorized\r\n"},
{403, "HTTP/1.1 403 Forbidden\r\n"},
{404, "HTTP/1.1 404 Not Found\r\n"},
+ {422, "HTTP/1.1 422 Unprocessable Entity\r\n"},
{500, "HTTP/1.1 500 Internal Server Error\r\n"},
{501, "HTTP/1.1 501 Not Implemented\r\n"},
diff --git a/examples/websocket/example_ws.cpp b/examples/websocket/example_ws.cpp
index ec3603c..e3c1b85 100644
--- a/examples/websocket/example_ws.cpp
+++ b/examples/websocket/example_ws.cpp
@@ -33,8 +33,13 @@ int main()
CROW_ROUTE(app, "/")
([]{
+ char name[256];
+ gethostname(name, 256);
+ crow::mustache::context x;
+ x["servername"] = name;
+
auto page = crow::mustache::load("ws.html");
- return page.render();
+ return page.render(x);
});
app.port(40080)
diff --git a/examples/websocket/templates/ws.html b/examples/websocket/templates/ws.html
index f6e7281..5200b8b 100644
--- a/examples/websocket/templates/ws.html
+++ b/examples/websocket/templates/ws.html
@@ -11,7 +11,7 @@
<textarea id="log" cols=100 rows=50>
</textarea>
<script>
-var sock = new WebSocket("ws://i.ipkn.me:40080/ws");
+var sock = new WebSocket("ws://{{servername}}:40080/ws");
sock.onopen = ()=>{
console.log('open')
}
diff --git a/include/crow/http_connection.h b/include/crow/http_connection.h
index 96f2d14..3ef8089 100644
--- a/include/crow/http_connection.h
+++ b/include/crow/http_connection.h
@@ -374,6 +374,7 @@ namespace crow
{401, "HTTP/1.1 401 Unauthorized\r\n"},
{403, "HTTP/1.1 403 Forbidden\r\n"},
{404, "HTTP/1.1 404 Not Found\r\n"},
+ {422, "HTTP/1.1 422 Unprocessable Entity\r\n"},
{500, "HTTP/1.1 500 Internal Server Error\r\n"},
{501, "HTTP/1.1 501 Not Implemented\r\n"},