forked from cory/tildefriends
I think the new HTTP implementation is basically working, now.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4707 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
#include "log.h"
|
||||
#include "mem.h"
|
||||
#include "task.h"
|
||||
#include "tlscontext.js.h"
|
||||
#include "util.js.h"
|
||||
|
||||
#include "picohttpparser.h"
|
||||
@ -291,7 +292,8 @@ static JSValue _httpd_start(JSContext* context, JSValueConst this_val, int argc,
|
||||
tf_http_t* http = JS_GetOpaque(this_val, _httpd_class_id);
|
||||
int port = 0;
|
||||
JS_ToInt32(context, &port, argv[0]);
|
||||
tf_http_listen(http, port);
|
||||
tf_tls_context_t* tls = tf_tls_context_get(JS_DupValue(context, argv[1]));
|
||||
tf_http_listen(http, port, tls);
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
@ -340,7 +342,7 @@ void tf_httpd_register(JSContext* context)
|
||||
JS_SetPropertyStr(context, httpd, "handlers", JS_NewObject(context));
|
||||
JS_SetPropertyStr(context, httpd, "all", JS_NewCFunction(context, _httpd_all, "all", 2));
|
||||
JS_SetPropertyStr(context, httpd, "registerSocketHandler", JS_NewCFunction(context, _httpd_register_socket_handler, "register_socket_handler", 2));
|
||||
JS_SetPropertyStr(context, httpd, "start", JS_NewCFunction(context, _httpd_start, "start", 1));
|
||||
JS_SetPropertyStr(context, httpd, "start", JS_NewCFunction(context, _httpd_start, "start", 2));
|
||||
JS_SetPropertyStr(context, global, "httpdc", httpd);
|
||||
JS_FreeValue(context, global);
|
||||
}
|
||||
|
Reference in New Issue
Block a user