summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@freehaven.net>2014-10-09 11:29:17 -0400
committerNick Mathewson <nickm@freehaven.net>2014-10-09 11:29:17 -0400
commit2e2d18bcd381070b9f77fa3f12f70c9e18306d63 (patch)
tree8e145e9b63f5e31131c81f53acf9fee1ab4d5602
parent163df09b2c1598c206fe804ef24b303fbb1a8f3e (diff)
parentd9da844369817a58d3f9eb10efc0be07f0a046b8 (diff)
downloadlibevent-2e2d18bcd381070b9f77fa3f12f70c9e18306d63.tar.gz
Merge pull request #170 from azat/https-client-retries
https-client: add -retries argument, for connection retries
-rw-r--r--sample/https-client.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sample/https-client.c b/sample/https-client.c
index b9bbb4ca..fbd5de8c 100644
--- a/sample/https-client.c
+++ b/sample/https-client.c
@@ -96,7 +96,7 @@ static void
syntax(void)
{
fputs("Syntax:\n", stderr);
- fputs(" https-client -url <https-url> [-data data-file.bin] [-ignore-cert]\n", stderr);
+ fputs(" https-client -url <https-url> [-data data-file.bin] [-ignore-cert] [-retries num]\n", stderr);
fputs("Example:\n", stderr);
fputs(" https-client -url https://ip.appspot.com/\n", stderr);
@@ -195,6 +195,7 @@ main(int argc, char **argv)
const char *scheme, *host, *path, *query;
char uri[256];
int port;
+ int retries = 0;
SSL_CTX *ssl_ctx;
SSL *ssl;
@@ -221,6 +222,12 @@ main(int argc, char **argv)
} else {
syntax();
}
+ } else if (!strcmp("-retries", argv[i])) {
+ if (i < argc - 1) {
+ retries = atoi(argv[i + 1]);
+ } else {
+ syntax();
+ }
} else if (!strcmp("-help", argv[i])) {
syntax();
}
@@ -375,6 +382,10 @@ main(int argc, char **argv)
return 1;
}
+ if (retries > 0) {
+ evhttp_connection_set_retries(evcon, retries);
+ }
+
// Fire off the request
req = evhttp_request_new(http_request_done, bev);
if (req == NULL) {