|
|
@@ -390,8 +390,7 @@ static void http_mg_cb(struct mg_connection *c, int ev, void *ev_data)
|
|
|
|
|
|
for(i=0; i<h->cnt; i++) {
|
|
|
if (h->fn[i].f && h->fn[i].uri && mg_match(hm->uri, mg_str(h->fn[i].uri), NULL)) {
|
|
|
- h->fn[i].f(&s);
|
|
|
- flag = 1;
|
|
|
+ h->fn[i].f(&s); flag = 1; break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -401,7 +400,7 @@ static void http_mg_cb(struct mg_connection *c, int ev, void *ev_data)
|
|
|
}
|
|
|
}
|
|
|
else if(ev == MG_EV_ACCEPT) {
|
|
|
- if (c->fn_data && c->is_tls) {
|
|
|
+ if (c->fn_data) {
|
|
|
mg_tls_init(c, &h->tls);
|
|
|
}
|
|
|
}
|
|
|
@@ -422,22 +421,23 @@ void *web_thread(void *arg)
|
|
|
strcpy(mh->rootDir, "/root/run/web");
|
|
|
|
|
|
|
|
|
- if ((c = mg_http_listen(&mgr, http_addr, http_mg_cb, NULL)) == NULL) {
|
|
|
+ if (mg_http_listen(&mgr, http_addr, http_mg_cb, NULL) == NULL) {
|
|
|
MG_ERROR(("cannot listen on %s\n", http_addr));
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
- if ((c = mg_http_listen(&mgr, https_addr, http_mg_cb, NULL)) == NULL) {
|
|
|
+ if (mg_http_listen(&mgr, https_addr, http_mg_cb, (void*)1) == NULL) {
|
|
|
MG_ERROR(("cannot listen on %s\n", https_addr));
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
webSetCallback();
|
|
|
printf("_____mgHandle.cnt: %d, rootdir: %s\n", mh->cnt, mh->rootDir);
|
|
|
|
|
|
mh->tls.cert = mg_str(file_load2("/root/run/app/cert/server.crt"));
|
|
|
mh->tls.key = mg_str(file_load2("/root/run/app/cert/server.key"));
|
|
|
- mh->tls.name = mg_url_host(https_addr);
|
|
|
+ //mh->tls.name = mg_url_host(https_addr);
|
|
|
while(h->quit==0) {
|
|
|
mg_mgr_poll(&mgr, 200);
|
|
|
}
|