opal-up 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +66 -51
  3. data/ext/up_ext/App.h +665 -544
  4. data/ext/up_ext/AsyncSocket.h +307 -284
  5. data/ext/up_ext/AsyncSocketData.h +35 -51
  6. data/ext/up_ext/BloomFilter.h +37 -42
  7. data/ext/up_ext/ChunkedEncoding.h +174 -175
  8. data/ext/up_ext/ClientApp.h +20 -23
  9. data/ext/up_ext/HttpContext.h +476 -381
  10. data/ext/up_ext/HttpContextData.h +20 -20
  11. data/ext/up_ext/HttpErrors.h +14 -10
  12. data/ext/up_ext/HttpParser.h +631 -563
  13. data/ext/up_ext/HttpResponse.h +526 -460
  14. data/ext/up_ext/HttpResponseData.h +59 -55
  15. data/ext/up_ext/HttpRouter.h +328 -310
  16. data/ext/up_ext/Loop.h +174 -168
  17. data/ext/up_ext/LoopData.h +60 -67
  18. data/ext/up_ext/MoveOnlyFunction.h +71 -80
  19. data/ext/up_ext/PerMessageDeflate.h +218 -198
  20. data/ext/up_ext/ProxyParser.h +100 -99
  21. data/ext/up_ext/QueryParser.h +91 -84
  22. data/ext/up_ext/TopicTree.h +273 -268
  23. data/ext/up_ext/Utilities.h +25 -25
  24. data/ext/up_ext/WebSocket.h +376 -310
  25. data/ext/up_ext/WebSocketContext.h +487 -372
  26. data/ext/up_ext/WebSocketContextData.h +74 -62
  27. data/ext/up_ext/WebSocketData.h +53 -46
  28. data/ext/up_ext/WebSocketExtensions.h +194 -178
  29. data/ext/up_ext/WebSocketHandshake.h +115 -110
  30. data/ext/up_ext/WebSocketProtocol.h +441 -398
  31. data/ext/up_ext/extconf.rb +1 -1
  32. data/ext/up_ext/libuwebsockets.cpp +1262 -1292
  33. data/ext/up_ext/libuwebsockets.h +337 -201
  34. data/ext/up_ext/up_ext.c +853 -163
  35. data/lib/up/bun/rack_env.rb +1 -13
  36. data/lib/up/bun/server.rb +93 -19
  37. data/lib/up/cli.rb +3 -0
  38. data/lib/up/client.rb +68 -0
  39. data/lib/up/ruby/cluster.rb +62 -0
  40. data/lib/up/ruby/rack_cluster.rb +1 -1
  41. data/lib/up/ruby/rack_server.rb +0 -1
  42. data/lib/up/u_web_socket/cluster.rb +18 -3
  43. data/lib/up/u_web_socket/server.rb +108 -15
  44. data/lib/up/version.rb +1 -1
  45. metadata +4 -15
  46. data/bin/up_node +0 -12
  47. data/bin/up_node_cluster +0 -12
  48. data/lib/up/node/cluster.rb +0 -39
  49. data/lib/up/node/cluster_cli.rb +0 -15
  50. data/lib/up/node/rack_cluster.rb +0 -25
  51. data/lib/up/node/rack_env.rb +0 -106
  52. data/lib/up/node/rack_server.rb +0 -25
  53. data/lib/up/node/server.rb +0 -84
  54. data/lib/up/node/server_cli.rb +0 -15
  55. data/lib/up/ruby/rack_env.rb +0 -97
  56. data/lib/up/u_web_socket/rack_env.rb +0 -101
@@ -20,37 +20,37 @@
20
20
 
21
21
  #include "HttpRouter.h"
22
22
 
23
- #include <vector>
24
23
  #include "MoveOnlyFunction.h"
24
+ #include <vector>
25
25
 
26
26
  namespace uWS {
27
- template<bool> struct HttpResponse;
27
+ template <bool> struct HttpResponse;
28
28
  struct HttpRequest;
29
29
 
30
- template <bool SSL>
31
- struct alignas(16) HttpContextData {
32
- template <bool> friend struct HttpContext;
33
- template <bool> friend struct HttpResponse;
34
- template <bool> friend struct TemplatedApp;
30
+ template <bool SSL> struct alignas(16) HttpContextData {
31
+ template <bool> friend struct HttpContext;
32
+ template <bool> friend struct HttpResponse;
33
+ template <bool> friend struct TemplatedApp;
34
+
35
35
  private:
36
- std::vector<MoveOnlyFunction<void(HttpResponse<SSL> *, int)>> filterHandlers;
36
+ std::vector<MoveOnlyFunction<void(HttpResponse<SSL> *, int)>> filterHandlers;
37
37
 
38
- MoveOnlyFunction<void(const char *hostname)> missingServerNameHandler;
38
+ MoveOnlyFunction<void(const char *hostname)> missingServerNameHandler;
39
39
 
40
- struct RouterData {
41
- HttpResponse<SSL> *httpResponse;
42
- HttpRequest *httpRequest;
43
- };
40
+ struct RouterData {
41
+ HttpResponse<SSL> *httpResponse;
42
+ HttpRequest *httpRequest;
43
+ };
44
44
 
45
- /* This is the currently browsed-to router when using SNI */
46
- HttpRouter<RouterData> *currentRouter = &router;
45
+ /* This is the currently browsed-to router when using SNI */
46
+ HttpRouter<RouterData> *currentRouter = &router;
47
47
 
48
- /* This is the default router for default SNI or non-SSL */
49
- HttpRouter<RouterData> router;
50
- void *upgradedWebSocket = nullptr;
51
- bool isParsingHttp = false;
48
+ /* This is the default router for default SNI or non-SSL */
49
+ HttpRouter<RouterData> router;
50
+ void *upgradedWebSocket = nullptr;
51
+ bool isParsingHttp = false;
52
52
  };
53
53
 
54
- }
54
+ } // namespace uWS
55
55
 
56
56
  #endif // UWS_HTTPCONTEXTDATA_H
@@ -23,9 +23,9 @@
23
23
  namespace uWS {
24
24
  /* Possible errors from http parsing */
25
25
  enum HttpError {
26
- HTTP_ERROR_505_HTTP_VERSION_NOT_SUPPORTED = 1,
27
- HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE = 2,
28
- HTTP_ERROR_400_BAD_REQUEST = 3
26
+ HTTP_ERROR_505_HTTP_VERSION_NOT_SUPPORTED = 1,
27
+ HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE = 2,
28
+ HTTP_ERROR_400_BAD_REQUEST = 3
29
29
  };
30
30
 
31
31
  #ifndef UWS_HTTPRESPONSE_NO_WRITEMARK
@@ -33,9 +33,14 @@ enum HttpError {
33
33
  /* Returned parser errors match this LUT. */
34
34
  static const std::string_view httpErrorResponses[] = {
35
35
  "", /* Zeroth place is no error so don't use it */
36
- "HTTP/1.1 505 HTTP Version Not Supported\r\nConnection: close\r\n\r\n<h1>HTTP Version Not Supported</h1><p>This server does not support HTTP/1.0.</p><hr><i>uWebSockets/20 Server</i>",
37
- "HTTP/1.1 431 Request Header Fields Too Large\r\nConnection: close\r\n\r\n<h1>Request Header Fields Too Large</h1><hr><i>uWebSockets/20 Server</i>",
38
- "HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n<h1>Bad Request</h1><hr><i>uWebSockets/20 Server</i>",
36
+ "HTTP/1.1 505 HTTP Version Not Supported\r\nConnection: "
37
+ "close\r\n\r\n<h1>HTTP Version Not Supported</h1><p>This server does not "
38
+ "support HTTP/1.0.</p><hr><i>uWebSockets/20 Server</i>",
39
+ "HTTP/1.1 431 Request Header Fields Too Large\r\nConnection: "
40
+ "close\r\n\r\n<h1>Request Header Fields Too "
41
+ "Large</h1><hr><i>uWebSockets/20 Server</i>",
42
+ "HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n<h1>Bad "
43
+ "Request</h1><hr><i>uWebSockets/20 Server</i>",
39
44
  };
40
45
 
41
46
  #else
@@ -44,10 +49,9 @@ static const std::string_view httpErrorResponses[] = {
44
49
  "", /* Zeroth place is no error so don't use it */
45
50
  "HTTP/1.1 505 HTTP Version Not Supported\r\nConnection: close\r\n\r\n",
46
51
  "HTTP/1.1 431 Request Header Fields Too Large\r\nConnection: close\r\n\r\n",
47
- "HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n"
48
- };
52
+ "HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n"};
49
53
  #endif
50
54
 
51
- }
55
+ } // namespace uWS
52
56
 
53
- #endif
57
+ #endif