feat(net): complete P2 M-NET-01..05 codec, pool, safe static open, redirects, and RFC 6455 WebSocket
This commit is contained in:
1 parent
700024a24d
commit
86d777eae6
14 files changed
+4346
-19
No files matched your search
@@ -1,10 +1,29 @@
|
||||
#include <Void/Net/Http.hpp>
|
||||
#include <Void/Net/HttpCodec.hpp>
|
||||
#include <Void/Net/HttpServer.hpp>
|
||||
#include <Void/Net/Pool.hpp>
|
||||
#include <Void/Net/WebSocket.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
int main()
|
||||
{
|
||||
if (Void::Net::compute_websocket_accept("dGhlIHNhbXBsZSBub25jZQ==") !=
|
||||
"s3pPLMBiTxaQ9kYGzzhZRbK+xOo=") {
|
||||
return 10;
|
||||
}
|
||||
Void::Net::HttpRequestParser parser;
|
||||
std::size_t consumed = 0;
|
||||
auto pr = parser.feed("GET /ping HTTP/1.1\r\nHost: localhost\r\n\r\n",
|
||||
consumed);
|
||||
if (!pr.has_value() || *pr != Void::Net::HttpParseStatus::Complete) {
|
||||
return 11;
|
||||
}
|
||||
Void::Net::ConnectionPool pool;
|
||||
if (pool.stats().total_connections != 0) {
|
||||
return 12;
|
||||
}
|
||||
|
||||
Void::Net::HttpServer server;
|
||||
if (!server
|
||||
.add_route(Void::Net::Method::Get, "/ping",
|
||||
|
||||
Reference in new issue
Block a user