Skip to content

Commit 76e4596

Browse files
authored
Merge pull request libgit2#5432 from libgit2/ethomson/sslread
httpclient: use a 16kb read buffer for macOS
2 parents cd6ed4e + 502e5d5 commit 76e4596

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/transports/httpclient.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,18 @@ static git_http_auth_scheme auth_schemes[] = {
2929
{ GIT_HTTP_AUTH_BASIC, "Basic", GIT_CREDENTIAL_USERPASS_PLAINTEXT, git_http_auth_basic },
3030
};
3131

32-
#define GIT_READ_BUFFER_SIZE 8192
32+
/*
33+
* Use a 16kb read buffer to match the maximum size of a TLS packet. This
34+
* is critical for compatibility with SecureTransport, which will always do
35+
* a network read on every call, even if it has data buffered to return to
36+
* you. That buffered data may be the _end_ of a keep-alive response, so
37+
* if SecureTransport performs another network read, it will wait until the
38+
* server ultimately times out before it returns that buffered data to you.
39+
* Since SecureTransport only reads a single TLS packet at a time, by
40+
* calling it with a read buffer that is the maximum size of a TLS packet,
41+
* we ensure that it will never buffer.
42+
*/
43+
#define GIT_READ_BUFFER_SIZE (16 * 1024)
3344

3445
typedef struct {
3546
git_net_url url;

0 commit comments

Comments
 (0)