Use a 16kb read buffer for compatibility with macOS SecureTransport. SecureTransport `SSLRead` has the following behavior: 1. It will return _at most_ one TLS packet's worth of data, and 2. It will try to give you as much data as you asked for This means that if you call `SSLRead` with a buffer size that is smaller than what _it_ reads (in other words, the maximum size of a TLS packet), then it will buffer that data for subsequent calls. However, it will also attempt to give you as much data as you requested in your SSLRead call. This means that it will guarantee a network read in the event that it has buffered data. Consider our 8kb buffer and a server sending us 12kb of data on an HTTP Keep-Alive session. Our first `SSLRead` will read the TLS packet off the network. It will return us the 8kb that we requested and buffer the remaining 4kb. Our second `SSLRead` call will see the 4kb that's buffered and decide that it could give us an additional 4kb. So it will do a network read. But there's nothing left to read; that was the end of the data. The HTTP server is waiting for us to provide a new request. The server will eventually time out, our `read` system call will return, `SSLRead` can return back to us and we can make progress. While technically correct, this is wildly ineffecient. (Thanks, Tim Apple!) Moving us to use an internal buffer that is the maximum size of a TLS packet (16kb) ensures that `SSLRead` will never buffer and it will always return everything that it read (albeit decrypted).
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
auth.c | Loading commit data... | |
auth.h | Loading commit data... | |
auth_negotiate.c | Loading commit data... | |
auth_negotiate.h | Loading commit data... | |
auth_ntlm.c | Loading commit data... | |
auth_ntlm.h | Loading commit data... | |
credential.c | Loading commit data... | |
credential_helpers.c | Loading commit data... | |
git.c | Loading commit data... | |
http.c | Loading commit data... | |
http.h | Loading commit data... | |
httpclient.c | Loading commit data... | |
httpclient.h | Loading commit data... | |
local.c | Loading commit data... | |
smart.c | Loading commit data... | |
smart.h | Loading commit data... | |
smart_pkt.c | Loading commit data... | |
smart_protocol.c | Loading commit data... | |
ssh.c | Loading commit data... | |
ssh.h | Loading commit data... | |
winhttp.c | Loading commit data... |