Skip to content

Commit

Permalink
ws: make resource configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Jan 5, 2016
1 parent 0665943 commit f2687dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 4 additions & 0 deletions modules/proto_ws/proto_ws.c
Expand Up @@ -55,6 +55,9 @@ int ws_send_timeout = 100;
/* in milliseconds */
int ws_hs_read_tout = 100;

/* XXX: this information should be dynamically provided */
static str ws_resource = str_init("/");

#define _ws_common_module "ws"
#define _ws_common_tcp_current_req tcp_current_req
#define _ws_common_current_req ws_current_req
Expand All @@ -63,6 +66,7 @@ int ws_hs_read_tout = 100;
#define _ws_common_writev ws_raw_writev
#define _ws_common_read_tout ws_hs_read_tout
#define _ws_common_write_tout ws_send_timeout
#define _ws_common_resource ws_resource
#include "ws_handshake_common.h"
#include "ws_common.h"

Expand Down
7 changes: 2 additions & 5 deletions modules/proto_ws/ws_handshake_common.h
Expand Up @@ -157,9 +157,6 @@ static const char base64alphabet[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
#define BASE64ALPHABET_LEN (sizeof base64alphabet)

/* XXX: this information should be dynamically provided */
static str ws_resource = str_init("/");


/* we're using a completely random key - no reason yet for something else */
static str ws_rand_key(void)
Expand Down Expand Up @@ -1213,8 +1210,8 @@ static int ws_start_handshake(struct tcp_connection *c)
host_orig_buf[n] = ':';
memcpy(host_orig_buf + n + 1, port, port_len);

iov[2].iov_base = ws_resource.s;
iov[2].iov_len = ws_resource.len;
iov[2].iov_base = _ws_common_resource.s;
iov[2].iov_len = _ws_common_resource.len;

iov[7].iov_len = n + port_len + 1;
iov[10].iov_len = iov[7].iov_len;
Expand Down

0 comments on commit f2687dc

Please sign in to comment.