Skip to content

Commit

Permalink
fix websocket operation
Browse files Browse the repository at this point in the history
  • Loading branch information
lwalkin committed Apr 18, 2015
1 parent e4faef2 commit 7a086c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/tcpkali_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ explode_data_template(struct transport_data_spec *data, struct loop_arguments *l
char *b = buf;
size_t offset = 0;
memcpy(b, data->ptr, data->ws_hdr_size);
b += offset;
b += data->ws_hdr_size;
offset += data->ws_hdr_size;

size_t once_size = data->once_size;
Expand Down Expand Up @@ -919,12 +919,13 @@ explode_data_template(struct transport_data_spec *data, struct loop_arguments *l
memcpy(b,
(char *)data->ptr + data->once_size,
data->total_size - data->once_size);
b += data->once_size - data->ws_hdr_size;
offset += data->once_size - data->ws_hdr_size;
total_size = once_size + (data->once_size - data->ws_hdr_size);
b += data->total_size - data->once_size;
offset += data->total_size - data->once_size;
total_size = once_size + (data->total_size - data->once_size);
}
*b = '\0';

assert(total_size <= buf_size);
assert((b - buf) == (ssize_t)total_size);

data->ptr = buf;
Expand Down
4 changes: 3 additions & 1 deletion src/tcpkali_expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ parse_payload_data(struct transport_data_spec *data, int debug) {
/*
* Attempt to find expression in headers.
*/
switch(parse_expression(&expr, data->ptr, data->once_size, debug)) {
switch(parse_expression(&expr,
(char *)data->ptr + data->ws_hdr_size,
data->once_size - data->ws_hdr_size, debug)) {
case 0: break;
default: return -1;
case 1:
Expand Down

0 comments on commit 7a086c2

Please sign in to comment.