remove http_match_uri()

This commit is contained in:
Sergio R. Caprile committed 2024-04-17 16:13:10 -03:00
1 parent e6bf658271
commit ef61d6ea48
34 files changed
+83 -93

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ static void wcb(struct mg_connection *c, int ev, void *ev_data) {
struct mg_http_message *hm = ev_data;
MG_INFO(("%.*s %.*s %ld", (int) hm->method.len, hm->method.buf,
(int) hm->uri.len, hm->uri.buf, (long) hm->body.len));
if (mg_http_match_uri(hm, "/api/#")) { // REST API requests
if (mg_match(hm->uri, mg_str("/api/#"), NULL)) { // REST API requests
// Print some statistics about currently established connections
mg_printf(c, "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n");
mg_http_printf_chunk(c, "ID PROTO TYPE LOCAL REMOTE\n");
+2 -2
View File
@@ -21,11 +21,11 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) {
mg_tls_init(c, &opts);
} else if (ev == MG_EV_HTTP_MSG) {
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
if (mg_http_match_uri(hm, "/websocket")) {
if (mg_match(hm->uri, mg_str("/websocket"), NULL)) {
// Upgrade to websocket. From now on, a connection is a full-duplex
// Websocket connection, which will receive MG_EV_WS_MSG events.
mg_ws_upgrade(c, hm, NULL);
} else if (mg_http_match_uri(hm, "/rest")) {
} else if (mg_match(hm->uri, mg_str("/rest"), NULL)) {
// Serve REST response
mg_http_reply(c, 200, "", "{\"result\": %d}\n", 123);
}