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.
@@ -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