aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-06-04 07:12:32 +0800
committerAndy Green <andy@warmcat.com>2018-06-04 07:14:49 +0800
commit44e5e1231be7ca1f962740b3c4162640436f8ab3 (patch)
tree1b7e4bc4a26b328da809e48d1ea00df52585ac88
parent6d72ef47686a55649a3bfbe453bfcc0a6d258bb5 (diff)
downloadlibwebsockets-44e5e1231be7ca1f962740b3c4162640436f8ab3.tar.gz
minimal client: add different paths to multi
-rw-r--r--minimal-examples/http-client/minimal-http-client-multi/README.md1
-rw-r--r--minimal-examples/http-client/minimal-http-client-multi/minimal-http-client-multi.c19
-rw-r--r--test-apps/1.pngbin0 -> 5249 bytes
-rw-r--r--test-apps/2.pngbin0 -> 5195 bytes
-rw-r--r--test-apps/3.pngbin0 -> 5171 bytes
-rw-r--r--test-apps/4.pngbin0 -> 5171 bytes
-rw-r--r--test-apps/5.pngbin0 -> 5114 bytes
-rw-r--r--test-apps/6.pngbin0 -> 5153 bytes
-rw-r--r--test-apps/7.pngbin0 -> 5055 bytes
-rw-r--r--test-apps/8.pngbin0 -> 5117 bytes
10 files changed, 16 insertions, 4 deletions
diff --git a/minimal-examples/http-client/minimal-http-client-multi/README.md b/minimal-examples/http-client/minimal-http-client-multi/README.md
index f31b6228..7eaac9dd 100644
--- a/minimal-examples/http-client/minimal-http-client-multi/README.md
+++ b/minimal-examples/http-client/minimal-http-client-multi/README.md
@@ -21,4 +21,5 @@ Option|Meaning
-p|Use http/1.1 pipelining or h2 simultaneous streams
--h1|Force http/1 only
-l|Connect to server on https://localhost:7681 instead of https://warmcat.com:443
+-n|Read numbered files like /1.png, /2.png etc. Default is just read /
diff --git a/minimal-examples/http-client/minimal-http-client-multi/minimal-http-client-multi.c b/minimal-examples/http-client/minimal-http-client-multi/minimal-http-client-multi.c
index 19940ffe..b84e01e3 100644
--- a/minimal-examples/http-client/minimal-http-client-multi/minimal-http-client-multi.c
+++ b/minimal-examples/http-client/minimal-http-client-multi/minimal-http-client-multi.c
@@ -40,7 +40,7 @@ struct user {
int index;
};
-static int interrupted, completed, failed;
+static int interrupted, completed, failed, numbered;
static struct lws *client_wsi[COUNT];
static struct user user[COUNT];
@@ -154,7 +154,13 @@ unsigned long long us(void)
static void
lws_try_client_connection(struct lws_client_connect_info *i, int m)
{
- i->path = "/";
+ char path[128];
+
+ if (numbered) {
+ lws_snprintf(path, sizeof(path), "/%d.png", m + 1);
+ i->path = path;
+ } else
+ i->path = "/";
i->pwsi = &client_wsi[m];
user[m].index = m;
@@ -167,7 +173,8 @@ lws_try_client_connection(struct lws_client_connect_info *i, int m)
interrupted = 1;
}
} else
- lwsl_user("started connection %p: idx %d\n", client_wsi[m], m);
+ lwsl_user("started connection %p: idx %d (%s)\n",
+ client_wsi[m], m, i->path);
}
int main(int argc, const char **argv)
@@ -196,7 +203,8 @@ int main(int argc, const char **argv)
lws_set_log_level(logs, NULL);
lwsl_user("LWS minimal http client [-s (staggered)] [-p (pipeline)]\n");
- lwsl_user(" [--h1 (http/1 only)] [-l (localhost)] [-d <logs>]\n");
+ lwsl_user(" [--h1 (http/1 only)] [-l (localhost)] [-d <logs>]\n");
+ lwsl_user(" [-n (numbered)]\n");
memset(&info, 0, sizeof info); /* otherwise uninitialized garbage */
info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
@@ -237,6 +245,9 @@ int main(int argc, const char **argv)
i.address = "warmcat.com";
}
+ if (lws_cmdline_option(argc, argv, "-n"))
+ numbered = 1;
+
if ((p = lws_cmdline_option(argc, argv, "--port")))
i.port = atoi(p);
diff --git a/test-apps/1.png b/test-apps/1.png
new file mode 100644
index 00000000..4a022b9d
--- /dev/null
+++ b/test-apps/1.png
Binary files differ
diff --git a/test-apps/2.png b/test-apps/2.png
new file mode 100644
index 00000000..d6bc9d1b
--- /dev/null
+++ b/test-apps/2.png
Binary files differ
diff --git a/test-apps/3.png b/test-apps/3.png
new file mode 100644
index 00000000..0f4614de
--- /dev/null
+++ b/test-apps/3.png
Binary files differ
diff --git a/test-apps/4.png b/test-apps/4.png
new file mode 100644
index 00000000..4319faad
--- /dev/null
+++ b/test-apps/4.png
Binary files differ
diff --git a/test-apps/5.png b/test-apps/5.png
new file mode 100644
index 00000000..4a2838cf
--- /dev/null
+++ b/test-apps/5.png
Binary files differ
diff --git a/test-apps/6.png b/test-apps/6.png
new file mode 100644
index 00000000..a6ee6481
--- /dev/null
+++ b/test-apps/6.png
Binary files differ
diff --git a/test-apps/7.png b/test-apps/7.png
new file mode 100644
index 00000000..d02ab817
--- /dev/null
+++ b/test-apps/7.png
Binary files differ
diff --git a/test-apps/8.png b/test-apps/8.png
new file mode 100644
index 00000000..f2f6e808
--- /dev/null
+++ b/test-apps/8.png
Binary files differ