- ws = proto->create(MHD_get_connection_info(con, MHD_CONNECTION_INFO_CONNECTION_FD)->connect_fd,
- context,
- (void*)MHD_resume_connection,
- con);
+ info = MHD_get_connection_info(con, MHD_CONNECTION_INFO_CONNECTION_FD);
+ if (info == NULL) {
+ response = MHD_create_response_from_buffer(0, NULL, MHD_RESPMEM_PERSISTENT);
+ MHD_queue_response(con, MHD_HTTP_INTERNAL_SERVER_ERROR, response);
+ MHD_destroy_response(response);
+ return 1;
+ }
+ ws = proto->create(info->connect_fd, context, (void*)MHD_resume_connection, con);