@@ -731,6 +731,7 @@ static enum MHD_Result on_request(void *cls, struct MHD_Connection *conn,
731731
732732 struct MHD_Response * resp = NULL ;
733733 enum MHD_Result ret ;
734+ int http_status = MHD_HTTP_OK ;
734735
735736 if (strcmp (url , ROUTE_USB_MOVE_CHECK ) == 0 ) {
736737 const char * path = MHD_lookup_connection_value (conn , MHD_GET_ARGUMENT_KIND , "path" );
@@ -922,16 +923,19 @@ static enum MHD_Result on_request(void *cls, struct MHD_Connection *conn,
922923 }
923924
924925 if (!final_path ) {
926+ pldmgr_log ("[PLDMGR] !!! Payload path rejected: %s\n" , path );
925927 const char * err = "Invalid payload name\n" ;
926928 resp = MHD_create_response_from_buffer (strlen (err ), (void * )err ,
927929 MHD_RESPMEM_PERSISTENT );
930+ http_status = MHD_HTTP_BAD_REQUEST ;
928931 } else if (ps5_launch_elf (final_path ) == 0 ) {
929932 resp = MHD_create_response_from_buffer (strlen (MSG_OK ), (void * )MSG_OK ,
930933 MHD_RESPMEM_PERSISTENT );
931934 } else {
932935 const char * err = "Failed to launch payload\n" ;
933936 resp = MHD_create_response_from_buffer (strlen (err ), (void * )err ,
934937 MHD_RESPMEM_PERSISTENT );
938+ http_status = MHD_HTTP_INTERNAL_SERVER_ERROR ;
935939 }
936940 MHD_add_response_header (resp , "Content-Type" , "text/plain" );
937941 } else if (strncmp (url , ROUTE_DELETE , strlen (ROUTE_DELETE )) == 0 ) {
@@ -1134,7 +1138,7 @@ static enum MHD_Result on_request(void *cls, struct MHD_Connection *conn,
11341138 /* Add CORS headers */
11351139 add_cors_headers (resp );
11361140
1137- ret = MHD_queue_response (conn , MHD_HTTP_OK , resp );
1141+ ret = MHD_queue_response (conn , http_status , resp );
11381142 MHD_destroy_response (resp );
11391143
11401144 return ret ;
0 commit comments