Import line: | Soup = imports.gi.Soup; |
GIR File: | Soup-2.4.gir |
C documentation: | SoupMessageHeaders |
Struct : | MessageHeaders |
None |
Method / Constructor | Defined By | |
---|---|---|
Create a new Soup.MessageHeaders
Create a new Soup.MessageHeaders
|
||
Appends a new header with name name and value value to hdrs.
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().) The caller is expected to make sure that name and value are syntactically correct.
|
Soup.MessageHeaders | |
clear
()
:
none
Clears hdrs.
Clears hdrs.
|
Soup.MessageHeaders | |
Calls func once for each header value in hdrs.
Calls func once for each header value in hdrs.
Beware that unlike soup_message_headers_get(), this processes the headers in exactly the way they were added, rather than concatenating multiple same-named headers into a single value. (This is intentional; it ensures that if you call soup_message_headers_append() multiple times with the same name, then the I/O code will output multiple copies of the header when sending the message to the remote implementation, which may be required for interoperability in some cases.) You may not modify the headers from func.
|
Soup.MessageHeaders | |
free
()
:
none
Frees hdrs.
Frees hdrs.
|
Soup.MessageHeaders | |
free_ranges
(Range ranges)
:
none
Frees the array of ranges returned from soup_message_headers_get_ranges().
Frees the array of ranges returned from soup_message_headers_get_ranges().
|
Soup.MessageHeaders | |
Gets the value of header name in hdrs.
Gets the value of header name in hdrs.
This method was supposed to work correctly for both single-valued and list-valued headers, but because some HTTP clients/servers mistakenly send multiple copies of headers that are supposed to be single-valued, it sometimes returns incorrect results. To fix this, the methods soup_message_headers_get_one() and soup_message_headers_get_list() were introduced, so callers can explicitly state which behavior they are expecting. soup_message_headers_get_list() instead.
|
Soup.MessageHeaders | |
Looks up the "Content-Disposition" header in hdrs, parses it, and
returns its value in *disposition and *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. In HTTP, the most common use of this header is to set a disposition-type of "attachment", to suggest to the browser that a response should be saved to disk rather than displayed in the browser. If params contains a "filename" parameter, this is a suggestion of a filename to use. (If the parameter value in the header contains an absolute or relative path, libsoup will truncate it down to just the final path component, so you do not need to test this yourself.) Content-Disposition is also used in "multipart/form-data", however this is handled automatically by SoupMultipart and the associated form methods. header, FALSE if not (in which case *disposition and *params will be unchanged).
|
Soup.MessageHeaders | |
get_content_length
()
:
gint64
Gets the message body length that hdrs declare.
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.
|
Soup.MessageHeaders | |
Parses hdrs's Content-Range header and returns it in start,
was specified as "*", then total_length will be set to -1.
Parses hdrs's Content-Range header and returns it in start,
was specified as "*", then total_length will be set to -1. containing a byte range which could be parsed, FALSE otherwise.
|
Soup.MessageHeaders | |
Looks up the "Content-Type" header in hdrs, parses it, and returns
its value in *content_type and *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. or NULL if hdrs does not contain that header or it cannot be parsed (in which case *params will be unchanged).
|
Soup.MessageHeaders | |
get_encoding
()
:
Soup.Encoding
Gets the message body encoding that hdrs declare.
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.
|
Soup.MessageHeaders | |
get_expectations
()
:
Soup.Expectation
Gets the expectations declared by hdrs's "Expect" header.
Gets the expectations declared by hdrs's "Expect" header.
Currently this will either be SOUP_EXPECTATION_CONTINUE or SOUP_EXPECTATION_UNRECOGNIZED.
|
Soup.MessageHeaders | |
Gets the value of header name in hdrs.
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(). If name appears multiple times in hdrs, soup_message_headers_get_list() will concatenate all of the values together, separated by commas. This is sometimes awkward to parse (eg, WWW-Authenticate, Set-Cookie), but you have to be able to deal with it anyway, because the HTTP spec explicitly states that this transformation is allowed, and so an upstream proxy could do the same thing.
|
Soup.MessageHeaders | |
Gets the value of header name in hdrs.
Gets the value of header name in hdrs. Use this for headers whose
values are which therefore can only appear at most once in the headers. For list-valued headers, use soup_message_headers_get_list(). If hdrs does erroneously contain multiple copies of the header, it is not defined which one will be returned. (Ideally, it will return whichever one makes libsoup most compatible with other HTTP implementations.)
|
Soup.MessageHeaders | |
Parses hdrs's Range header and returns an array of the requested
byte 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(). If total_length is non-0, its value will be used to adjust the returned ranges to have explicit start and end values, and the returned ranges will be sorted and non-overlapping. If as described under SoupRange, and some of the ranges may be redundant. byte ranges which could be parsed, FALSE otherwise (in which case
|
Soup.MessageHeaders | |
remove
(String name)
:
none
Removes name from hdrs.
Removes name from hdrs. If there are multiple values for name,
they are all removed.
|
Soup.MessageHeaders | |
Replaces the value of the header name in hdrs with value.
Replaces the value of the header name in hdrs with value. (See
also soup_message_headers_append().) The caller is expected to make sure that name and value are syntactically correct.
|
Soup.MessageHeaders | |
Sets the "Content-Disposition" header in hdrs to disposition,
optionally with additional parameters specified in params.
Sets the "Content-Disposition" header in hdrs to disposition,
optionally with additional parameters specified in params. See soup_message_headers_get_content_disposition() for a discussion of how Content-Disposition is used in HTTP.
|
Soup.MessageHeaders | |
set_content_length
(gint64 content_length)
:
none
Sets the message body length that hdrs will declare, and sets
You do not normally need to call this; if hdrs is set to use Content-Length encoding, libsoup will automatically set its Content-Length header for you immediately before sending the headers.
Sets the message body length that hdrs will declare, and sets
You do not normally need to call this; if hdrs is set to use Content-Length encoding, libsoup will automatically set its Content-Length header for you immediately before sending the headers. One situation in which this method is useful is when generating the response to a HEAD request; Calling soup_message_headers_set_content_length() allows you to put the correct content length into the response without needing to waste memory by filling in a response body which won't actually be sent.
|
Soup.MessageHeaders | |
Sets hdrs's Content-Range header according to the given values.
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.)
|
Soup.MessageHeaders | |
Sets the "Content-Type" header in hdrs to content_type,
optionally with additional parameters specified in params. |
Soup.MessageHeaders | |
set_encoding
(Encoding encoding)
:
none
Sets the message body encoding that hdrs will declare.
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.
|
Soup.MessageHeaders | |
set_expectations
(Expectation expectations)
:
none
Sets hdrs's "Expect" header according to expectations.
Sets hdrs's "Expect" header according to expectations.
Currently SOUP_EXPECTATION_CONTINUE is the only known expectation value. You should set this value on a request if you are sending a large message body (eg, via POST or PUT), and want to give the server a chance to reject the request after seeing just the headers (eg, because it will require authentication before allowing you to post, or because you're POSTing to a URL that doesn't exist). This saves you from having to transmit the large request body when the server is just going to ignore it anyway.
|
Soup.MessageHeaders | |
Sets hdrs's Range header to request the indicated range.
|
Soup.MessageHeaders | |
Sets hdrs's Range header to request the indicated ranges.
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().)
|
Soup.MessageHeaders |
None |
Class / Namespace | Method / Signal / Properties |
---|---|
Soup
Method |
Parses the headers of an HTTP request or response in str and
stores the results in dest. |
Soup
Method |
Soup.headers_parse_request
(String str, gint32 len, MessageHeaders req_headers, Object out_values)
:
guint32
Parses the headers of an HTTP request in str and stores the
results in req_method, req_path, ver, and req_headers. |
Soup
Method |
Soup.headers_parse_response
(String str, gint32 len, MessageHeaders headers, Object out_values)
:
gboolean
Parses the headers of an HTTP response in str and stores the
results in ver, status_code, reason_phrase, and headers. |
Soup.Message
Property |
request_headers : Soup.MessageHeaders
read only
|
Soup.Message
Property |
response_headers : Soup.MessageHeaders
read only
|
Soup.MessageHeadersIter
Method |
init
(MessageHeaders hdrs)
:
none
Initializes iter for iterating hdrs.
|
Soup.Multipart
Method |
Create a new Soup.Multipart
|
Soup.Multipart
Method |
append_part
(MessageHeaders headers, Buffer body)
:
none
Adds a new MIME part to multipart with the given headers and body.
|
Soup.Multipart
Method |
Gets the indicated body part from multipart.
|
Soup.Multipart
Method |
to_message
(MessageHeaders dest_headers, MessageBody dest_body)
:
none
Serializes multipart to dest_headers and dest_body.
|