Socket.readUntil

Like soup_socket_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.

soup_socket_read_until() will almost always return fewer than @len 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 <literal>(boundary_len - 1)</literal> bytes in its internal buffer, in case they form the start of the boundary string. Thus, @len normally needs to be at least 1 byte longer than @boundary_len if you want to make any progress at all.

class Socket
readUntil
(
ubyte[] buffer
,
void* boundary
,,
out size_t nread
,,
Cancellable cancellable
)

Parameters

buffer ubyte[]

buffer to read into

boundary void*

boundary to read until

boundaryLen size_t

length of @boundary in bytes

nread size_t

on return, the number of bytes read into @buffer

gotBoundary bool*

on return, whether or not the data in @buffer ends with the boundary string

cancellable Cancellable

a #GCancellable, or %NULL

Return Value

as for soup_socket_read()

Throws

GException on failure.

Meta