diff options
Diffstat (limited to 'shared/protocol.c')
-rw-r--r-- | shared/protocol.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/shared/protocol.c b/shared/protocol.c index 225b46f..55e6759 100644 --- a/shared/protocol.c +++ b/shared/protocol.c @@ -50,14 +50,11 @@ void ws_protocol_parse_req_byte(ws_s_protocol_req_parser_state* state, char inpu // send response char response_first_line[16]; sprintf(response_first_line, "%s,%x\n", response->success == WS_PROTOCOL_CMD_RETURN_OK ? "ok" : "error", response->msg->bytes); - ws_s_bin* response_first_line_bin = ws_bin_s_alloc(strlen(response_first_line)); - strncpy((char*) response_first_line_bin->data, response_first_line, strlen(response_first_line)); - ws_protocol_send_data(response_first_line_bin); - if (!response->csh) ws_protocol_send_data(response->msg); + ws_protocol_send_data(response_first_line, strlen(response_first_line)); + if (!response->csh) ws_protocol_send_data((char*) response->msg->data, response->msg->bytes); else (*g_ws_protocol_res_handlers[response->cmd_code])(state->target, response, true); // free response data containers - free(response_first_line_bin); free(response->msg); free(response); |