MessageBody

#SoupMessageBody represents the request or response body of a #SoupMessage.

In addition to #SoupMessageBody, libsoup also defines a "smaller" data buffer type, #SoupBuffer, which is primarily used as a component of #SoupMessageBody. In particular, when using chunked encoding to transmit or receive a message, each chunk is represented as a #SoupBuffer.

Constructors

this
this(SoupMessageBody* soupMessageBody, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Creates a new #SoupMessageBody. #SoupMessage uses this internally; you will not normally need to call it yourself.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

append
void append(SoupMemoryUse use, ubyte[] data)

Appends @length bytes from @data to @body according to @use.

appendBuffer
void appendBuffer(Buffer buffer)

Appends the data from @buffer to @body. (#SoupMessageBody uses #SoupBuffers internally, so this is normally a constant-time operation that doesn't actually require copying the data in @buffer.)

appendTake
void appendTake(char[] data)

Appends @length bytes from @data to @body.

complete
void complete()

Tags @body as being complete; Call this when using chunked encoding after you have appended the last chunk.

flatten
Buffer flatten()

Fills in @body's data field with a buffer containing all of the data in @body (plus an additional '\0' byte not counted by @body's length field).

free
void free()

Frees @body. You will not normally need to use this, as #SoupMessage frees its associated message bodies automatically.

getAccumulate
bool getAccumulate()

Gets the accumulate flag on @body; see soup_message_body_set_accumulate() for details.

getChunk
Buffer getChunk(long offset)

Gets a #SoupBuffer containing data from @body starting at @offset. The size of the returned chunk is unspecified. You can iterate through the entire body by first calling soup_message_body_get_chunk() with an offset of 0, and then on each successive call, increment the offset by the length of the previously-returned chunk.

getMessageBodyStruct
SoupMessageBody* getMessageBodyStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

gotChunk
void gotChunk(Buffer chunk)

Handles the #SoupMessageBody part of receiving a chunk of data from the network. Normally this means appending @chunk to @body, exactly as with soup_message_body_append_buffer(), but if you have set @body's accumulate flag to %FALSE, then that will not happen.

setAccumulate
void setAccumulate(bool accumulate)

Sets or clears the accumulate flag on @body. (The default value is %TRUE.) If set to %FALSE, @body's %data field will not be filled in after the body is fully sent/received, and the chunks that make up @body may be discarded when they are no longer needed.

truncate
void truncate()

Deletes all of the data in @body.

wroteChunk
void wroteChunk(Buffer chunk)

Handles the #SoupMessageBody part of writing a chunk of data to the network. Normally this is a no-op, but if you have set @body's accumulate flag to %FALSE, then this will cause @chunk to be discarded to free up memory.

Properties

data
string data [@property getter]
string data [@property setter]

the data

length
long length [@property getter]
long length [@property setter]

length of @data

Static functions

getType
GType getType()

Variables

ownedRef
bool ownedRef;
Undocumented in source.
soupMessageBody
SoupMessageBody* soupMessageBody;

the main Gtk struct

Meta