opal-up 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/up_ext/App.h +665 -544
- data/ext/up_ext/AsyncSocket.h +307 -284
- data/ext/up_ext/AsyncSocketData.h +35 -51
- data/ext/up_ext/BloomFilter.h +37 -42
- data/ext/up_ext/ChunkedEncoding.h +174 -175
- data/ext/up_ext/ClientApp.h +20 -23
- data/ext/up_ext/HttpContext.h +476 -381
- data/ext/up_ext/HttpContextData.h +20 -20
- data/ext/up_ext/HttpErrors.h +14 -10
- data/ext/up_ext/HttpParser.h +631 -563
- data/ext/up_ext/HttpResponse.h +526 -460
- data/ext/up_ext/HttpResponseData.h +59 -55
- data/ext/up_ext/HttpRouter.h +328 -310
- data/ext/up_ext/Loop.h +174 -168
- data/ext/up_ext/LoopData.h +60 -67
- data/ext/up_ext/MoveOnlyFunction.h +71 -80
- data/ext/up_ext/PerMessageDeflate.h +218 -198
- data/ext/up_ext/ProxyParser.h +100 -99
- data/ext/up_ext/QueryParser.h +91 -84
- data/ext/up_ext/TopicTree.h +273 -268
- data/ext/up_ext/Utilities.h +25 -25
- data/ext/up_ext/WebSocket.h +376 -310
- data/ext/up_ext/WebSocketContext.h +487 -372
- data/ext/up_ext/WebSocketContextData.h +74 -62
- data/ext/up_ext/WebSocketData.h +53 -46
- data/ext/up_ext/WebSocketExtensions.h +194 -178
- data/ext/up_ext/WebSocketHandshake.h +115 -110
- data/ext/up_ext/WebSocketProtocol.h +441 -398
- data/ext/up_ext/up_ext.c +43 -5
- data/lib/up/ruby/cluster.rb +29 -6
- data/lib/up/version.rb +1 -1
- metadata +2 -2
@@ -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
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
36
|
+
std::vector<MoveOnlyFunction<void(HttpResponse<SSL> *, int)>> filterHandlers;
|
37
37
|
|
38
|
-
|
38
|
+
MoveOnlyFunction<void(const char *hostname)> missingServerNameHandler;
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
struct RouterData {
|
41
|
+
HttpResponse<SSL> *httpResponse;
|
42
|
+
HttpRequest *httpRequest;
|
43
|
+
};
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
/* This is the currently browsed-to router when using SNI */
|
46
|
+
HttpRouter<RouterData> *currentRouter = &router;
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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
|
data/ext/up_ext/HttpErrors.h
CHANGED
@@ -23,9 +23,9 @@
|
|
23
23
|
namespace uWS {
|
24
24
|
/* Possible errors from http parsing */
|
25
25
|
enum HttpError {
|
26
|
-
|
27
|
-
|
28
|
-
|
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:
|
37
|
-
"
|
38
|
-
"HTTP/1.
|
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
|