@@ -422,6 +422,25 @@ void uWS_App_removeServerName(const FunctionCallbackInfo<Value> &args) {
422422 args.GetReturnValue ().Set (args.Holder ());
423423}
424424
425+ template <typename APP >
426+ void uWS_App_missingServerName (const FunctionCallbackInfo<Value> &args) {
427+ APP *app = (APP *) args.Holder ()->GetAlignedPointerFromInternalField (0 );
428+ Isolate *isolate = args.GetIsolate ();
429+
430+ UniquePersistent<Function> missingPf;
431+ missingPf.Reset (args.GetIsolate (), Local<Function>::Cast (args[0 ]));
432+
433+ app->missingServerName ([missingPf = std::move (missingPf), isolate](const char *hostname) {
434+ /* We hand a JavaScript string here */
435+ HandleScope hs (isolate);
436+ Local<Function> missingLf = Local<Function>::New (isolate, missingPf);
437+ Local<Value> argv[1 ] = {String::NewFromUtf8 (isolate, hostname, NewStringType::kNormal ).ToLocalChecked ()};
438+ CallJS (isolate, missingLf, 1 , argv);
439+ });
440+
441+ args.GetReturnValue ().Set (args.Holder ());
442+ }
443+
425444template <typename APP >
426445void uWS_App (const FunctionCallbackInfo<Value> &args) {
427446
@@ -496,6 +515,7 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
496515 /* SNI */
497516 appTemplate->PrototypeTemplate ()->Set (String::NewFromUtf8 (isolate, " addServerName" , NewStringType::kNormal ).ToLocalChecked (), FunctionTemplate::New (isolate, uWS_App_addServerName<APP >, args.Data ()));
498517 appTemplate->PrototypeTemplate ()->Set (String::NewFromUtf8 (isolate, " removeServerName" , NewStringType::kNormal ).ToLocalChecked (), FunctionTemplate::New (isolate, uWS_App_removeServerName<APP >, args.Data ()));
518+ appTemplate->PrototypeTemplate ()->Set (String::NewFromUtf8 (isolate, " missingServerName" , NewStringType::kNormal ).ToLocalChecked (), FunctionTemplate::New (isolate, uWS_App_missingServerName<APP >, args.Data ()));
499519
500520 Local<Object> localApp = appTemplate->GetFunction (isolate->GetCurrentContext ()).ToLocalChecked ()->NewInstance (isolate->GetCurrentContext ()).ToLocalChecked ();
501521 localApp->SetAlignedPointerInInternalField (0 , app);
0 commit comments