-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new middleware relevant for web applications intended to be rendered in a web browser: useIsSecureRequestMiddleware - Record on request whether it was delivered via a secure channel. useHstsMiddleware - Inform browsers that your app should only be visited via HTTPS. useStaticFilesMiddleware - Serves static files. useRoutingMiddleware - Adds the ability to route a request to a handler. Must be used with and called before useHandlerMiddleware. useBrowserHardeningMiddleware - Harden the browser environment your web app is rendered in. useHandlerMiddleware - Calls a selected handler after routing. Must be used with and called after useRoutingMiddleware. Middleware are specified in WebAppSettings.middleware. Refactor static file handling into a middleware. Some web application middleware are irrelevant for static files and with the previous handler implementation there was no ability to opt out of them. With a static files middleware we can short-circuit early and keep static file serving lean as we add more middleware. Add protection against trusting client-provided security headers from misconfigured proxies. Add conversion of exceptions to requests in middleware system. This enables surfacing messages on error conditions from deep within middleware. Add core package for exceptions and other centrally-required code.
- Loading branch information
1 parent
ef9b18b
commit db88be6
Showing
14 changed files
with
1,162 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module potcake.core.exceptions; | ||
@safe: | ||
|
||
class ImproperlyConfigured : Exception | ||
{ | ||
this(string msg, string file = __FILE__, size_t line = __LINE__) @safe | ||
{ | ||
super(msg, file, line); | ||
} | ||
} | ||
|
||
class SuspiciousOperation : Exception | ||
{ | ||
this(string msg, string file = __FILE__, size_t line = __LINE__) | ||
{ | ||
super(msg, file, line); | ||
} | ||
} | ||
|
||
class DisallowedHost : SuspiciousOperation | ||
{ | ||
this(string msg, string file = __FILE__, size_t line = __LINE__) | ||
{ | ||
super(msg, file, line); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module potcake.core; | ||
|
||
public import potcake.core.exceptions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.