+ if (afb_hreq_init_context(hreq) < 0) {
+ afb_hreq_reply_error(hreq, MHD_HTTP_INTERNAL_SERVER_ERROR);
+ return 1;
+ }
+
+ if (!hreq->xreq.context.validated) {
+ afb_hreq_reply_error(hreq, MHD_HTTP_UNAUTHORIZED);
+ return 1;
+ }
+
+ return afb_websock_check_upgrade(hreq, apiset);