@ -511,6 +511,14 @@ static const char *websocket_http_ng(struct websocket_message *wm) {
static const char * websocket_http_404 ( struct websocket_message * wm ) {
ilogs ( http , LOG_WARN , " Unhandled HTTP URI: '%s' " , wm - > uri ) ;
websocket_http_complete ( wm - > wc , 404 , " text/plain " , 10 , " not found \n " ) ;
return NULL ;
}
static int websocket_http_get ( struct websocket_conn * wc ) {
struct websocket_message * wm = wc - > wm ;
const char * uri = wm - > uri ;
@ -525,12 +533,8 @@ static int websocket_http_get(struct websocket_conn *wc) {
handler = websocket_http_cli ;
else if ( ! strcmp ( uri , " /metrics " ) )
handler = websocket_http_metrics ;
if ( ! handler ) {
ilogs ( http , LOG_WARN , " Unhandled HTTP GET URI: '%s' " , uri ) ;
websocket_http_complete ( wm - > wc , 404 , " text/plain " , 10 , " not found \n " ) ;
return 0 ;
}
else
handler = websocket_http_404 ;
websocket_message_push ( wc , handler ) ;
return 0 ;
@ -594,12 +598,8 @@ static int websocket_http_body(struct websocket_conn *wc, const char *body, size
handler = websocket_http_ng ;
else if ( ! strcmp ( uri , " /admin " ) & & wm - > method = = M_POST & & wm - > content_type = = CT_JSON )
handler = websocket_janus_process ;
if ( ! handler ) {
ilogs ( http , LOG_WARN , " Unhandled HTTP POST URI: '%s' " , wm - > uri ) ;
websocket_http_complete ( wm - > wc , 404 , " text/plain " , 10 , " not found \n " ) ;
return 0 ;
}
else
handler = websocket_http_404 ;
websocket_message_push ( wc , handler ) ;
return 0 ;