ooni-probe-cli/internal/ooapi
Simone Basso 0fdc9cafb5
fix(all): introduce and use iox.ReadAllContext (#379)
* fix(all): introduce and use iox.ReadAllContext

This improvement over the ioutil.ReadAll utility returns early
if the context expires. This enables us to unblock stuck code in
case there's censorship confounding the TCP stack.

See https://github.com/ooni/probe/issues/1417.

Compared to the functionality postulated in the above mentioned
issue, I choose to be more generic and separate limiting the
maximum body size (not implemented here) from using the context
to return early when reading a body (or any other reader).

After implementing iox.ReadAllContext, I made sure we always
use it everywhere in the tree instead of ioutil.ReadAll.

This includes many parts of the codebase where in theory we don't
need iox.ReadAllContext. Though, changing all the places makes
checking whether we're not using ioutil.ReadAll where we should
not be using it easy: `git grep` should return no lines.

* Update internal/iox/iox_test.go

* fix(ndt7): treat context errors as non-errors

The rationale is explained by the comment documenting reduceErr.

* Update internal/engine/experiment/ndt7/download.go
2021-06-15 11:57:40 +02:00
..
apimodel refactor: flatten and separate (#353) 2021-06-04 10:34:18 +02:00
internal fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
apis_test.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
apis.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
caching_test.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
caching.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
callers.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
client.go doc: cleanup and improve for recently moved pkgs (#354) 2021-06-04 11:39:00 +02:00
clientcall_test.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
clientcall.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
cloners.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
default_test.go refactor: flatten and separate (#353) 2021-06-04 10:34:18 +02:00
default.go refactor: flatten and separate (#353) 2021-06-04 10:34:18 +02:00
dependencies.go doc: cleanup and improve for recently moved pkgs (#354) 2021-06-04 11:39:00 +02:00
doc.go doc: cleanup and improve for recently moved pkgs (#354) 2021-06-04 11:39:00 +02:00
errors.go refactor: flatten and separate (#353) 2021-06-04 10:34:18 +02:00
example_test.go doc: cleanup and improve for recently moved pkgs (#354) 2021-06-04 11:39:00 +02:00
fake_test.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
fakeapi_test.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
fakefill_test.go refactor: flatten and separate (#353) 2021-06-04 10:34:18 +02:00
httpclient_test.go refactor: flatten and separate (#353) 2021-06-04 10:34:18 +02:00
integration_test.go refactor: flatten and separate (#353) 2021-06-04 10:34:18 +02:00
login_test.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
login.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
loginhandler_test.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
loginmodel.go refactor: flatten and separate (#353) 2021-06-04 10:34:18 +02:00
requests.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
responses.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
swagger_test.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
swaggerdiff_test.go fix(all): introduce and use iox.ReadAllContext (#379) 2021-06-15 11:57:40 +02:00
utils_test.go refactor: flatten and separate (#353) 2021-06-04 10:34:18 +02:00
utils.go refactor: flatten and separate (#353) 2021-06-04 10:34:18 +02:00