Rather than only fetching the total in on request and discarding all the
data, re-use the first page of data and then collect more of them if the
data set exceeds the page size.
This patch also includes various fixes to the GPA server to mimic
proton server behavior.
The original fixes to parse the HV error message unfortunately caused
those corrected error routes to start failing when tested against live
proton servers.
Since HV error parsing was improved in a subsequent patch, we no longer
needs the original fix and can therefore revert the changes that are
causing issues.
The APIError that was composed in certain replies needs to be kept
separate so that the custom `UnmarshalJSON` does not override the
composed struct's implementation. This can lead to fields not being
deserialized properly.
Implement basic message deduplication for GPA server. This functionality
is opt-in. It's not enabled by default in order to not break any
existing tests are written against the previous behavior.
The test HTTP client is not configured with any timeouts.
If the read fails, depending on when it happens, it can hang indefinitely.
This was unpredictable with the way the test was written before;
the message fetching was highly parallel. By replacing the message fetch
with a simple GetUser call which fails predictably, the test is made
more robust.
Expose mechanism for a user of the library to control how the
attachments should be downloaded.
`AttachmentAllocator` allows the user to specify where the byte
buffers for the attachments should originate from.
`Scheduler` allows the user to control how the attachments should be
downloaded. `SequentialScheduler` and `ParallelScheduler` are provided
as reference implementations.