MessageHeaders

#SoupMessageHeaders represents the HTTP message headers associated with a request or response.

class MessageHeaders {}

Constructors

this
this(SoupMessageHeaders* soupMessageHeaders, bool ownedRef)

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

this
this(SoupMessageHeadersType type)

Creates a #SoupMessageHeaders. (#SoupMessage does this automatically for its own headers. You would only need to use this method if you are manually parsing or generating message headers.)

Destructor

~this
~this()
Undocumented in source.

Members

Aliases

foreac
alias foreac = foreach_
Undocumented in source.

Functions

append
void append(string name, string value)

Appends a new header with name @name and value @value to @hdrs. (If there is an existing header with name @name, then this creates a second one, which is only allowed for list-valued headers; see also soup_message_headers_replace().)

cleanConnectionHeaders
void cleanConnectionHeaders()

Removes all the headers listed in the Connection header.

clear
void clear()

Clears @hdrs.

foreach_
void foreach_(SoupMessageHeadersForeachFunc func, void* userData)

Calls @func once for each header value in @hdrs.

free
void free()

Frees @hdrs.

freeRanges
void freeRanges(SoupRange* ranges)

Frees the array of ranges returned from soup_message_headers_get_ranges().

get
string get(string name)

Gets the value of header @name in @hdrs.

getContentDisposition
bool getContentDisposition(string disposition, HashTable params)

Looks up the "Content-Disposition" header in @hdrs, parses it, and returns its value in *@disposition and *@params. @params can be %NULL if you are only interested in the disposition-type.

getContentLength
long getContentLength()

Gets the message body length that @hdrs declare. This will only be non-0 if soup_message_headers_get_encoding() returns %SOUP_ENCODING_CONTENT_LENGTH.

getContentRange
bool getContentRange(long start, long end, long totalLength)

Parses @hdrs's Content-Range header and returns it in @start, @end, and @total_length. If the total length field in the header was specified as "*", then @total_length will be set to -1.

getContentType
string getContentType(HashTable params)

Looks up the "Content-Type" header in @hdrs, parses it, and returns its value in *@content_type and *@params. @params can be %NULL if you are only interested in the content type itself.

getEncoding
SoupEncoding getEncoding()

Gets the message body encoding that @hdrs declare. This may not always correspond to the encoding used on the wire; eg, a HEAD response may declare a Content-Length or Transfer-Encoding, but it will never actually include a body.

getExpectations
SoupExpectation getExpectations()

Gets the expectations declared by @hdrs's "Expect" header. Currently this will either be %SOUP_EXPECTATION_CONTINUE or %SOUP_EXPECTATION_UNRECOGNIZED.

getHeadersType
SoupMessageHeadersType getHeadersType()

Gets the type of headers.

getList
string getList(string name)

Gets the value of header @name in @hdrs. Use this for headers whose values are comma-delimited lists, and which are therefore allowed to appear multiple times in the headers. For non-list-valued headers, use soup_message_headers_get_one().

getMessageHeadersStruct
SoupMessageHeaders* getMessageHeadersStruct(bool transferOwnership)

Get the main Gtk struct

getOne
string getOne(string name)

Gets the value of header @name in @hdrs. Use this for headers whose values are <emphasis>not</emphasis> comma-delimited lists, and which therefore can only appear at most once in the headers. For list-valued headers, use soup_message_headers_get_list().

getRanges
bool getRanges(long totalLength, SoupRange[] ranges)

Parses @hdrs's Range header and returns an array of the requested byte ranges. The returned array must be freed with soup_message_headers_free_ranges().

getStruct
void* getStruct()

the main Gtk struct as a void*

headerContains
bool headerContains(string name, string token)

Checks whether the list-valued header @name is present in @hdrs, and contains a case-insensitive match for @token.

headerEquals
bool headerEquals(string name, string value)

Checks whether the header @name is present in @hdrs and is (case-insensitively) equal to @value.

remove
void remove(string name)

Removes @name from @hdrs. If there are multiple values for @name, they are all removed.

replace
void replace(string name, string value)

Replaces the value of the header @name in @hdrs with @value. (See also soup_message_headers_append().)

setContentDisposition
void setContentDisposition(string disposition, HashTable params)

Sets the "Content-Disposition" header in @hdrs to @disposition, optionally with additional parameters specified in @params.

setContentLength
void setContentLength(long contentLength)

Sets the message body length that @hdrs will declare, and sets @hdrs's encoding to %SOUP_ENCODING_CONTENT_LENGTH.

setContentRange
void setContentRange(long start, long end, long totalLength)

Sets @hdrs's Content-Range header according to the given values. (Note that @total_length is the total length of the entire resource that this is a range of, not simply @end - @start + 1.)

setContentType
void setContentType(string contentType, HashTable params)

Sets the "Content-Type" header in @hdrs to @content_type, optionally with additional parameters specified in @params.

setEncoding
void setEncoding(SoupEncoding encoding)

Sets the message body encoding that @hdrs will declare. In particular, you should use this if you are going to send a request or response in chunked encoding.

setExpectations
void setExpectations(SoupExpectation expectations)

Sets @hdrs's "Expect" header according to @expectations.

setRange
void setRange(long start, long end)

Sets @hdrs's Range header to request the indicated range. @start and @end are interpreted as in a #SoupRange.

setRanges
void setRanges(SoupRange* ranges, int length)

Sets @hdrs's Range header to request the indicated ranges. (If you only want to request a single range, you can use soup_message_headers_set_range().)

Static functions

getType
GType getType()

Variables

ownedRef
bool ownedRef;
Undocumented in source.
soupMessageHeaders
SoupMessageHeaders* soupMessageHeaders;

the main Gtk struct

Meta