diff options
author | Andy Green <andy@warmcat.com> | 2011-02-06 17:42:06 +0000 |
---|---|---|
committer | Andy Green <andy@warmcat.com> | 2011-02-06 17:42:06 +0000 |
commit | 1efb63c2bef1d1e33ed5c5935c3cd297bbabc51e (patch) | |
tree | 4599ac773566f500bc5f63fa2ecb329c7990567d /test-server/test-client.c | |
parent | 927eb7b90d2786ab3d1291a32ddb7fc873f709a0 (diff) |
fix-hostname-to-be-server-name--allow-switches-in-any-order.patch
Signed-off-by: Andy Green <andy@warmcat.com>
Diffstat (limited to 'test-server/test-client.c')
-rw-r--r-- | test-server/test-client.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test-server/test-client.c b/test-server/test-client.c index e03d115..59595e0 100644 --- a/test-server/test-client.c +++ b/test-server/test-client.c @@ -168,7 +168,7 @@ int main(int argc, char **argv) int port = 7681; int use_ssl = 0; struct libwebsocket_context *context; - const char *address = argv[1]; + const char *address; struct libwebsocket *wsi_dumb; struct libwebsocket *wsi_mirror; @@ -200,6 +200,11 @@ int main(int argc, char **argv) } } + if (optind >= argc) + goto usage; + + address = argv[optind]; + /* * create the websockets context. This tracks open connections and * knows how to route any traffic and which protocol version to use, @@ -219,7 +224,7 @@ int main(int argc, char **argv) /* create a client websocket using dumb increment protocol */ wsi_dumb = libwebsocket_client_connect(context, address, port, use_ssl, - "/", libwebsocket_canonical_hostname(context), "origin", + "/", argv[optind], argv[optind], protocols[PROTOCOL_DUMB_INCREMENT].name); if (wsi_dumb == NULL) { @@ -230,7 +235,7 @@ int main(int argc, char **argv) /* create a client websocket using mirror protocol */ wsi_mirror = libwebsocket_client_connect(context, address, port, - use_ssl, "/", libwebsocket_canonical_hostname(context), "origin", + use_ssl, "/", argv[optind], argv[optind], protocols[PROTOCOL_LWS_MIRROR].name); if (wsi_mirror == NULL) { |