Like read, but reads no further than the first occurrence of boundary
.
(If the boundary is found, it will be included in the returned data, and *got_boundary
will be set to true
.)
Any data after the boundary will returned in future reads.
read_until will almost always return fewer than buffer.length
bytes: if the boundary is found,
then it will only return the bytes up until the end of the boundary, and if the boundary is not found, then it will leave the last
(boundary_len - 1) bytes in its internal buffer, in case they form the start of the boundary string. Thus, buffer.length
normally needs to be at least 1 byte longer than boundary_len
if you want to make any progress at all.
this |
the socket |
buffer |
buffer to read into |
boundary |
boundary to read until |
boundary_len |
length of |
nread |
on return, the number of bytes read into |
got_boundary |
on return, whether or not the data in |
cancellable |
a Cancellable, or |
len |
size of |
as for read |