Skip to content

Commit d38a292

Browse files
committed
Make it compile with cache
1 parent 59a0b48 commit d38a292

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

‎src/AppWrapper.h‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -934,9 +934,10 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
934934
/* All the http methods */
935935
appTemplate->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "get", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, [](auto &args) {
936936

937-
/* Add non-cached variants */
937+
/* Is this non-SSL? */
938938
if constexpr (std::is_same<APP, uWS::App>::value) {
939939

940+
/* Did we get 3 arguments (cached registry)? */
940941
if (args.Length() == 3) {
941942

942943
/* Get secondsToExpiry */
@@ -993,11 +994,17 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
993994

994995

995996
} else {
996-
uWS_App_get<APP>(&uWS::TemplatedApp<false>::get, args);
997+
/* This is non-SSL but not using cache */
998+
//uWS_App_get<APP>(&uWS::TemplatedApp<false>::get, args);
999+
1000+
uWS_App_get<APP>(static_cast<APP && (APP::*)(std::string, uWS::MoveOnlyFunction<void(uWS::HttpResponse<false> *, uWS::HttpRequest *)> &&)>(&APP::get), args);
9971001
}
9981002

9991003
} else if constexpr (std::is_same<APP, uWS::SSLApp>::value) {
1000-
uWS_App_get<APP>(&uWS::TemplatedApp<true>::get, args);
1004+
/* This is SSL and not using cache */
1005+
//uWS_App_get<APP>(&uWS::TemplatedApp<true>::get, args);
1006+
1007+
uWS_App_get<APP>(static_cast<APP && (APP::*)(std::string, uWS::MoveOnlyFunction<void(uWS::HttpResponse<true> *, uWS::HttpRequest *)> &&)>(&APP::get), args);
10011008
}
10021009

10031010
}, args.Data()));

‎src/HttpResponseWrapper.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ struct HttpResponseWrapper {
4444
if constexpr (PROTOCOL == 2) {
4545
return (uWS::Http3Response *) res;
4646
} else if constexpr (PROTOCOL == 3) {
47-
//return (uWS::CachingHttpResponse *) res; // is correct
48-
return (uWS::HttpResponse<PROTOCOL != 0> *) res; // not correct
47+
return (uWS::HttpCacheResponse *) res; // is correct
48+
//return (uWS::HttpResponse<PROTOCOL != 0> *) res; // not correct
4949
} else {
5050
return (uWS::HttpResponse<PROTOCOL != 0> *) res;
5151
}
@@ -589,11 +589,11 @@ struct HttpResponseWrapper {
589589
} else if (SSL == 2) {
590590
resTemplateLocal->SetClassName(String::NewFromUtf8(isolate, "uWS.Http3Response", NewStringType::kNormal).ToLocalChecked());
591591
} else if (SSL == 3) {
592-
resTemplateLocal->SetClassName(String::NewFromUtf8(isolate, "uWS.CachedHttpResponse", NewStringType::kNormal).ToLocalChecked());
592+
resTemplateLocal->SetClassName(String::NewFromUtf8(isolate, "uWS.HttpCacheResponse", NewStringType::kNormal).ToLocalChecked());
593593
}
594594
resTemplateLocal->InstanceTemplate()->SetInternalFieldCount(1);
595595

596-
/* Register our functions */
596+
/* Register our functions (the most common go here) */
597597
resTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "end", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, res_end<SSL>));
598598

599599
/* Cache has almost nothing wrapped yet */

0 commit comments

Comments
 (0)