@@ -27,27 +27,27 @@ char* toStringPtr(std::string cppString){
2727 return cstr;
2828}
2929
30- void http_serve (struct mg_connection *c, int ev, void *ev_data, void *fn_data ) {
30+ void http_serve (struct mg_connection *c, int ev, void *ev_data) {
3131 if (ev == MG_EV_HTTP_MSG) {
3232 // struct mg_http_message *message_data = (struct mg_http_message *) ev_data;
3333 struct mg_http_message *message_data = reinterpret_cast <struct mg_http_message *>(ev_data);
3434 const char *final_headers = DEFAULT_HEADER CORS_HEADERS;
3535 struct mg_str json = message_data->body ;
3636
37- MO_DBG_VERBOSE (" %.*s" , 20 , message_data->uri .ptr );
37+ MO_DBG_VERBOSE (" %.*s" , 20 , message_data->uri .buf );
3838
3939 MicroOcpp::Method method = MicroOcpp::Method::UNDEFINED;
4040
41- if (!mg_vcasecmp (& message_data->method , " POST" )) {
41+ if (!mg_strcasecmp ( message_data->method , mg_str ( " POST" ) )) {
4242 method = MicroOcpp::Method::POST;
4343 MO_DBG_VERBOSE (" POST" );
44- } else if (!mg_vcasecmp (& message_data->method , " GET" )) {
44+ } else if (!mg_strcasecmp ( message_data->method , mg_str ( " GET" ) )) {
4545 method = MicroOcpp::Method::GET;
4646 MO_DBG_VERBOSE (" GET" );
4747 }
4848
4949 // start different api endpoints
50- if (mg_http_match_uri (message_data, " /api/websocket" )){
50+ if (mg_match (message_data-> uri , mg_str ( " /api/websocket" ), NULL )){
5151 MO_DBG_VERBOSE (" query websocket" );
5252 auto webSocketPingIntervalInt = MicroOcpp::declareConfiguration<int >(" WebSocketPingInterval" , 10 , MO_WSCONN_FN);
5353 auto reconnectIntervalInt = MicroOcpp::declareConfiguration<int >(MO_CONFIG_EXT_PREFIX " ReconnectInterval" , 30 , MO_WSCONN_FN);
@@ -91,23 +91,23 @@ void http_serve(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
9191 serializeJson (doc, serialized);
9292 mg_http_reply (c, 200 , final_headers, serialized.c_str ());
9393 return ;
94- } else if (strncmp (message_data->uri .ptr , " /api" , strlen (" api" )) == 0 ) {
94+ } else if (strncmp (message_data->uri .buf , " /api" , strlen (" api" )) == 0 ) {
9595 #define RESP_BUF_SIZE 1024
9696 char resp_buf [RESP_BUF_SIZE];
9797
9898 // replace endpoint-body separator by null
99- if (char *c = strchr ((char *) message_data->uri .ptr , ' ' )) {
99+ if (char *c = strchr ((char *) message_data->uri .buf , ' ' )) {
100100 *c = ' \0 ' ;
101101 }
102102
103103 int status = mocpp_api_call (
104- message_data->uri .ptr + strlen (" /api" ),
104+ message_data->uri .buf + strlen (" /api" ),
105105 method,
106- message_data->body .ptr ,
106+ message_data->body .buf ,
107107 resp_buf, RESP_BUF_SIZE);
108108
109109 mg_http_reply (c, status, final_headers, resp_buf);
110- } else if (mg_http_match_uri (message_data, " /" )) { // if no specific path is given serve dashboard application file
110+ } else if (mg_match (message_data-> uri , mg_str ( " /" ), NULL )) { // if no specific path is given serve dashboard application file
111111 struct mg_http_serve_opts opts;
112112 memset (&opts, 0 , sizeof (opts));
113113 opts.root_dir = " ./public" ;
0 commit comments