mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-13 06:16:10 -04:00
https-client: add -retries argument, for connection retries
Using evhttp_connection_set_retries() API.
This commit is contained in:
parent
07b5e45ba5
commit
d9da844369
@ -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();
|
||||
}
|
||||
@ -373,6 +380,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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user