Reduce memory copies when processing cloud requests (#22493)
* http_api_v2() copied each response body 3 times before MQTT publish (web_client -> local_buffer -> full_msg). Add aclk_http_msg_v2_direct() which assembles JSON header + separator + HTTP headers + body into a single buffer and transfers ownership to MQTT via the existing freefnc zero-copy path. Drops body copies from 3 to 1, and peak coexistent copies from 3 to 2. No on-wire protocol change; error paths untouched. * Address review comments * Use `json_object_to_json_string_length` to calculate JSON string length directly during serialization. * Handle message allocation errors and prevent size overflows during message composition. * Update MQTT publishing logic and simplify memory free functions - Correct the return code check for `mqtt_ng_publish` in MQTT WebSocket client. - Consolidate redundant memory free functions (`freez_aclk_publish5{a,b,c}`) into `freez_aclk_publish_msg`. - Replace `int` with `bool` for clearer payload existence checks. - Minor cleanup and improvements in message assembly and publishing paths. * Refactor MQTT publishing logic to centralize error handling and clarify ownership contracts * Document single-free invariant in `mqtt_ng_generate_publish` to prevent potential double-free scenarios. * Initialize `packet_id` to prevent potential use of uninitialized variable in MQTT publish path. * Normalize NULL pointers for `http_headers` and `body` by setting their respective lengths to 0 to prevent mismatched allocation sizes and maintain consistency during message composition. * Rebase onto master, fix compilation * Initialize `packet_id` to 0 on failure to prevent potential misuse in MQTT WebSocket client. * Clarify ownership contracts and simplify error handling in MQTT publish path, ensuring consistent cleanup on failure. * Add null check for `packet_id` in MQTT publish path to prevent potential misuse. * Clarify ownership and rollback contract for `mqtt_ng_publish` and enforce `topic_free` NULL-check to prevent asymmetric cleanup issues. * Handle non-OK return code in `aclk_tx_msgs` by mapping to `HTTP_RESP_INTERNAL_SERVER_ERROR`. * Normalize return code in `mqtt_wss_wakeup` to use `MQTT_WSS_OK` for consistency.