mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-11 12:55:43 +00:00
add command POST at api/cmnd
This commit is contained in:
@ -110,7 +110,7 @@ static void tcp_client_thread( beken_thread_arg_t arg )
|
||||
// returns length to be sent if any
|
||||
int lenret = HTTP_ProcessPacket(&request);
|
||||
if (lenret > 0){
|
||||
ADDLOG_DEBUG(LOG_FEATURE_HTTP, "TCP sending reply len %i\n",lenret );
|
||||
//ADDLOG_DEBUG(LOG_FEATURE_HTTP, "TCP sending reply len %i\n",lenret );
|
||||
send( fd, reply, lenret, 0 );
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ static void tcp_server_thread( beken_thread_arg_t arg )
|
||||
#endif
|
||||
#endif
|
||||
os_strcpy( client_ip_str, inet_ntoa( client_addr.sin_addr ) );
|
||||
ADDLOG_DEBUG(LOG_FEATURE_HTTP, "TCP Client %s:%d connected, fd: %d", client_ip_str, client_addr.sin_port, client_fd );
|
||||
// ADDLOG_DEBUG(LOG_FEATURE_HTTP, "TCP Client %s:%d connected, fd: %d", client_ip_str, client_addr.sin_port, client_fd );
|
||||
#if DISABLE_SEPARATE_THREAD_FOR_EACH_TCP_CLIENT
|
||||
// Use main server thread (blocking all other clients)
|
||||
// right now, I am getting OS_ThreadCreate everytime on XR809 platform
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include "../new_cfg.h"
|
||||
#include "../flash_config/flash_vars_vars.h"
|
||||
#include "../flash_config/flash_vars.h"
|
||||
#include "../new_cmd.h"
|
||||
|
||||
extern UINT32 flash_read(char *user_buf, UINT32 count, UINT32 address);
|
||||
|
||||
@ -55,6 +56,7 @@ static int http_rest_get_channels(http_request_t *request);
|
||||
|
||||
static int http_rest_get_flash_vars_test(http_request_t *request);
|
||||
|
||||
static int http_rest_post_cmd(http_request_t *request);
|
||||
|
||||
|
||||
void init_rest(){
|
||||
@ -184,6 +186,11 @@ static int http_rest_post(http_request_t *request){
|
||||
return http_rest_post_flash_advanced(request);
|
||||
}
|
||||
|
||||
if (!strcmp(request->url, "api/cmnd")){
|
||||
return http_rest_post_cmd(request);
|
||||
}
|
||||
|
||||
|
||||
#ifdef BK_LITTLEFS
|
||||
if (!strcmp(request->url, "api/fsblock")){
|
||||
if (lfs_present()){
|
||||
@ -1072,3 +1079,11 @@ static int http_rest_post_channels(http_request_t *request){
|
||||
return http_rest_error(request, 200, "OK");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int http_rest_post_cmd(http_request_t *request){
|
||||
char *cmd = request->bodystart;
|
||||
CMD_ExecuteCommand(cmd);
|
||||
return http_rest_error(request, 200, "OK");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user