On Fri, 27 Jul 2018 22:03:10 +0200, Jacob Carlborg wrote:
On 2018-07-27 20:58, Russel Winder wrote:
cf. https://vibed.org/api/vibe.core.stream/InputStream.read
ubyte[256] buffer; auto n = req.bodyReader.read(buffer, IOMode.once);
appears to work fine as long as there are 256
ubyte
s to read. If however the end of stream means there are less than 256ubyte
s available then an exception is thrown.At first sight this seems inconsistent with the read returning the number of
ubyte
s read.Or am I missing something?
The documentation says:
"The return value is guaranteed to be dst.length for IOMode.all."
"IOMode.all" is the default. I'm not sure if that's the reason.
It appears that the documentation does not reflect the behaviour of the code: it seems that the behaviour of the code is "fill the buffer totally or throw an exception". In effect the behaviour of the documentation is not implemented. I tried with IOMode.all
as well as IOMode.once
and the behaviour is the same.
It seems this bit of vibe.d has to be considered as broken. :-(