Skip to content

Commit

Permalink
Add a setting for HTTP Upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
Heromyth committed Mar 3, 2022
1 parent 2ca36c2 commit f06465d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/hunt/framework/config/ApplicationConfig.d
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class ApplicationConfig {
size_t keepAliveTimeOut = 30;
size_t maxHeaderSize = 64 * 1024;
int cacheControl;
bool canUpgrade = true;
bool enableCors = false; // CORS support
string allowOrigin = "*";
string allowMethods = "*";
Expand Down
2 changes: 2 additions & 0 deletions source/hunt/framework/controller/Controller.d
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ abstract class Controller
}

HttpConnection httpConnection = context.httpConnection();
if(httpConnection is null)
throw new Error("The http connection is null!");

_request = new Request(context.getRequest(),
httpConnection.getRemoteAddress(),
Expand Down
1 change: 1 addition & 0 deletions source/hunt/framework/provider/HttpServiceProvider.d
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class HttpServiceProvider : ServiceProvider {
.maxRequestSize(cast(int)appConfig.http.maxHeaderSize)
.maxFileSize(cast(int)appConfig.upload.maxSize)
.ioThreadSize(appConfig.http.ioThreads)
.canUpgrade(appConfig.http.canUpgrade)
.resourceCacheTime(staticFilesConfig.cacheTime.seconds);

version(WITH_HUNT_TRACE) {
Expand Down

0 comments on commit f06465d

Please sign in to comment.