summaryrefslogtreecommitdiff
path: root/src/stream.h
Commit message (Collapse)AuthorAgeFilesLines
* streams: fix callers potentially only writing partial dataPatrick Steinhardt2019-01-311-0/+15
| | | | | | | | | | | | | | | | | | | | | Similar to the write(3) function, implementations of `git_stream_write` do not guarantee that all bytes are written. Instead, they return the number of bytes that actually have been written, which may be smaller than the total number of bytes. Furthermore, due to an interface design issue, we cannot ever write more than `SSIZE_MAX` bytes at once, as otherwise we cannot represent the number of bytes written to the caller. Unfortunately, no caller of `git_stream_write` ever checks the return value, except to verify that no error occurred. Due to this, they are susceptible to the case where only partial data has been written. Fix this by introducing a new function `git_stream__write_full`. In contrast to `git_stream_write`, it will always return either success or failure, without returning the number of bytes written. Thus, it is able to write all `SIZE_MAX` bytes and loop around `git_stream_write` until all data has been written. Adjust all callers except the BIO callbacks in our mbedtls and OpenSSL streams, which already do the right thing and require the amount of bytes written.
* git_error: use new names in internal APIs and usageEdward Thomson2019-01-221-2/+2
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* net: use proxy options struct in the stream configCarlos Martín Nieto2016-04-191-2/+2
|
* stream: accept NULL in the free functionCarlos Martín Nieto2015-11-031-0/+3
|
* stream: add support for setting a proxyCarlos Martín Nieto2015-06-241-0/+15
| | | | | | | | If the stream claims to support this feature, we can let the transport set the proxy. We also set HTTPPROXYTUNNEL option so curl can create a tunnel through the proxy which lets us create our own TLS session (if needed).
* http: do not try to use the cert callback on unencrypted streamscmn/stream-check-ecCarlos Martín Nieto2015-03-161-0/+5
| | | | | | | | | When the user has a certificate check callback set, we still have to check whether the stream we're using is even capable of providing a certificate. In the case of an unencrypted certificate, do not ask for it from the stream, and do not call the callback.
* Fix a couple of compiler warningsCarlos Martín Nieto2014-12-101-1/+1
|
* stream: constify the write bufferCarlos Martín Nieto2014-12-101-1/+1
|
* Introduce stackable IO streamsCarlos Martín Nieto2014-12-101-0/+48
We currently have gitno for talking over TCP, but this needs to know about both plaintext and OpenSSL connections and the code has gotten somewhat messy with ifdefs determining which version of the function should be called. In order to clean this up and abstract away the details of sending over the different types of streams, we can instead use an interface and stack stream implementations. We may not be able to use the stackability with all streams, but we are definitely be able to use the abstraction which is currently spread between different bits of gitno.