diff --git a/build/client.o b/build/client.o index 87b1a98..2bf2d14 100644 Binary files a/build/client.o and b/build/client.o differ diff --git a/build/intercept.so b/build/intercept.so index 1b9c76a..2cd026b 100755 Binary files a/build/intercept.so and b/build/intercept.so differ diff --git a/config/config.yaml b/config/config.yaml index c2903c7..89edbfb 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -1,4 +1,4 @@ machine_registry: - endpoint: "http://localhost:9900" -log: + endpoint: "http://localhost:3001/endpoint" +log: level: OFF \ No newline at end of file diff --git a/src/client.c b/src/client.c index 179cd7b..d4ef014 100644 --- a/src/client.c +++ b/src/client.c @@ -1,11 +1,12 @@ #include "client.h" + +#include +#include +#include #include #include #include #include -#include -#include -#include #define BUFFER_SIZE 4096 @@ -14,14 +15,14 @@ ssize_t readMessage(int sock, char *buffer, size_t maxSize) { uint32_t messageLen; // 先读取消息长度 if (read(sock, &messageLen, sizeof(messageLen)) != sizeof(messageLen)) { - return -1; + return -1; } - + // 检查buffer大小是否足够 if (messageLen >= maxSize) { return -1; } - + // 读取完整消息 size_t totalRead = 0; while (totalRead < messageLen) { @@ -44,7 +45,7 @@ int send_exec_params(const char *filename, char *const argv[], return -1; } - if (logPath[0] != '/') { // 相对路径 + if (logPath[0] != '/') { // 相对路径 size_t pwd_len = strlen(pwd); size_t log_len = strlen(logPath); if (pwd_len + log_len + 2 > PATH_MAX) { @@ -144,7 +145,7 @@ int send_exec_params(const char *filename, char *const argv[], close(sock); return -1; } - + if (strstr(buffer, "[sthttp]")) { started = 1; } @@ -161,19 +162,10 @@ int send_exec_params(const char *filename, char *const argv[], break; } - // 处理[res]...[wait]消息 - char *res_start = strstr(buffer, "[res]"); - char *wait_end = strstr(buffer, "[wait]"); - - if (res_start && wait_end) { - size_t content_len = wait_end - (res_start + strlen("[res]")); - if (content_len < BUFFER_SIZE) { - strncpy(display_buffer, res_start + strlen("[res]"), content_len); - display_buffer[content_len] = '\0'; - printf("%s\n", display_buffer); - fflush(stdout); - } - } + strncpy(display_buffer, buffer, BUFFER_SIZE - 1); + display_buffer[BUFFER_SIZE - 1] = '\0'; + printf("%s", display_buffer); + fflush(stdout); } close(sock);