diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2023-03-30 12:05:04 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2023-03-30 12:29:09 +0100 |
commit | c362cc91c7fec17972d216d98355d40116087845 (patch) | |
tree | 0c7cecfafa111af458f5b8582bdfa9f1be29bac1 | |
parent | 2f20fe8869d7a1df7c9b7a9e2939c1a20533c6dc (diff) | |
download | libgit2-c362cc91c7fec17972d216d98355d40116087845.tar.gz |
http: ensure that we can handle broken keep-alives
Test against our testing HTTP server that we can support the case when
the server (legally) breaks the connection after the first successful
request/response on a keep-alive connection.
-rw-r--r-- | tests/libgit2/online/clone.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/libgit2/online/clone.c b/tests/libgit2/online/clone.c index b635739b6..2590ea995 100644 --- a/tests/libgit2/online/clone.c +++ b/tests/libgit2/online/clone.c @@ -33,6 +33,7 @@ static char *_remote_proxy_user = NULL; static char *_remote_proxy_pass = NULL; static char *_remote_proxy_selfsigned = NULL; static char *_remote_expectcontinue = NULL; +static char *_remote_nokeepalive = NULL; static char *_remote_redirect_initial = NULL; static char *_remote_redirect_subsequent = NULL; @@ -87,6 +88,7 @@ void test_online_clone__initialize(void) _remote_proxy_pass = cl_getenv("GITTEST_REMOTE_PROXY_PASS"); _remote_proxy_selfsigned = cl_getenv("GITTEST_REMOTE_PROXY_SELFSIGNED"); _remote_expectcontinue = cl_getenv("GITTEST_REMOTE_EXPECTCONTINUE"); + _remote_nokeepalive = cl_getenv("GITTEST_REMOTE_NOKEEPALIVE"); _remote_redirect_initial = cl_getenv("GITTEST_REMOTE_REDIRECT_INITIAL"); _remote_redirect_subsequent = cl_getenv("GITTEST_REMOTE_REDIRECT_SUBSEQUENT"); @@ -126,6 +128,7 @@ void test_online_clone__cleanup(void) git__free(_remote_proxy_pass); git__free(_remote_proxy_selfsigned); git__free(_remote_expectcontinue); + git__free(_remote_nokeepalive); git__free(_remote_redirect_initial); git__free(_remote_redirect_subsequent); @@ -1207,3 +1210,13 @@ void test_online_clone__sha256(void) git_reference_free(head); #endif } + +void test_online_clone__closed_connection(void) +{ + git_clone_options options = GIT_CLONE_OPTIONS_INIT; + + if (!_remote_nokeepalive) + cl_skip(); + + cl_git_pass(git_clone(&g_repo, _remote_nokeepalive, "./nokeepalive", &options)); +} |