![]() |
![]() |
![]() |
libsoup Reference Manual | ![]() |
---|---|---|---|---|
char* soup_base64_decode (const gchar *text, int *out_len); char* soup_base64_encode (const char *text, int len); int soup_base64_decode_step (const guchar *in, int len, guchar *out, int *state, guint *save); int soup_base64_encode_step (const guchar *in, int len, gboolean break_lines, guchar *out, int *state, int *save); int soup_base64_encode_close (const guchar *in, int inlen, gboolean break_lines, guchar *out, int *state, int *save); GSource* soup_add_idle (GMainContext *async_context, GSourceFunc function, gpointer data); GSource* soup_add_io_watch (GMainContext *async_context, GIOChannel *chan, GIOCondition condition, GIOFunc function, gpointer data); GSource* soup_add_timeout (GMainContext *async_context, guint interval, GSourceFunc function, gpointer data); guint soup_signal_connect_once (gpointer instance, const char *detailed_signal, GCallback c_handler, gpointer data); time_t soup_date_parse (const char *timestamp); time_t soup_date_iso8601_parse (const char *timestamp); char* soup_date_generate (time_t when); void soup_gmtime (const time_t *when, struct tm *tm); time_t soup_mktime_utc (struct tm *tm); char* soup_header_param_copy_token (GHashTable *tokens, char *t); char* soup_header_param_decode_token (char **in); void soup_header_param_destroy_hash (GHashTable *table); GHashTable* soup_header_param_parse_list (const char *header); gboolean soup_headers_parse_request (const char *str, int len, GHashTable *dest, char **req_method, char **req_path, SoupHttpVersion *ver); gboolean soup_headers_parse_response (const char *str, int len, GHashTable *dest, SoupHttpVersion *ver, guint *status_code, char **reason_phrase); gboolean soup_headers_parse_status_line (const char *status_line, SoupHttpVersion *ver, guint *status_code, char **reason_phrase); gboolean soup_str_case_equal (gconstpointer v1, gconstpointer v2); guint soup_str_case_hash (gconstpointer key); xmlNode* soup_xml_real_node (xmlNode *node);
char* soup_base64_decode (const gchar *text, int *out_len);
|
|
|
|
Returns : |
int soup_base64_decode_step (const guchar *in, int len, guchar *out, int *state, guint *save);
|
|
|
|
|
|
|
|
|
|
Returns : |
int soup_base64_encode_step (const guchar *in, int len, gboolean break_lines, guchar *out, int *state, int *save);
|
|
|
|
|
|
|
|
|
|
|
|
Returns : |
int soup_base64_encode_close (const guchar *in, int inlen, gboolean break_lines, guchar *out, int *state, int *save);
|
|
|
|
|
|
|
|
|
|
|
|
Returns : |
GSource* soup_add_idle (GMainContext *async_context, GSourceFunc function, gpointer data);
Adds an idle event as with g_idle_add()
, but using the given
async_context
.
|
the GMainContext to dispatch the idle event in, or
NULL for the default context
|
|
the callback to invoke at idle time |
|
user data to pass to function
|
Returns : |
a GSource, which can be removed from async_context
with g_source_destroy() .
|
GSource* soup_add_io_watch (GMainContext *async_context, GIOChannel *chan, GIOCondition condition, GIOFunc function, gpointer data);
Adds an I/O watch as with g_io_add_watch()
, but using the given
async_context
.
|
the GMainContext to dispatch the I/O watch in, or
NULL for the default context
|
|
the GIOChannel to watch |
|
the condition to watch for |
|
the callback to invoke when condition occurs
|
|
user data to pass to function
|
Returns : |
a GSource, which can be removed from async_context
with g_source_destroy() .
|
GSource* soup_add_timeout (GMainContext *async_context, guint interval, GSourceFunc function, gpointer data);
Adds a timeout as with g_timeout_add()
, but using the given
async_context
.
|
the GMainContext to dispatch the timeout in, or
NULL for the default context
|
|
the timeout interval, in milliseconds |
|
the callback to invoke at timeout time |
|
user data to pass to function
|
Returns : |
a GSource, which can be removed from async_context
with g_source_destroy() .
|
guint soup_signal_connect_once (gpointer instance, const char *detailed_signal, GCallback c_handler, gpointer data);
Connects a GCallback function to a signal as with
g_signal_connect()
, but automatically removes the signal handler
after its first invocation.
|
an object |
|
"signal-name" or "signal-name::detail" to connect to |
|
the GCallback to connect |
|
data to pass to c_handler calls
|
Returns : |
the signal handler id |
time_t soup_date_parse (const char *timestamp);
Parses timestamp
and returns its value as a time_t.
|
a timestamp, in any of the allowed HTTP 1.1 formats |
Returns : |
the time_t corresponding to timestamp , or -1 if
timestamp couldn't be parsed.
|
time_t soup_date_iso8601_parse (const char *timestamp);
Converts timestamp
to a time_t
value. timestamp
can be in any of the
iso8601 formats that specify both a date and a time.
|
an ISO8601 timestamp |
Returns : |
the time_t corresponding to timestamp , or -1 on error.
|
char* soup_date_generate (time_t when);
Generates an HTTP 1.1 Date header corresponding to when
.
|
the time to generate a timestamp for |
Returns : |
the timestamp, which the caller must free. |
void soup_gmtime (const time_t *when, struct tm *tm);
Expands when
into tm
(as a UTC time). This is just a wrapper
around gmtime_r()
(or gmtime()
on lame platforms). (The Microsoft C
library on Windows doesn't have gmtime_r()
, but its gmtime()
is in
fact thread-safe as it uses a per-thread buffer, so it's not
totally lame ;-)
|
a time_t |
|
a struct tm to be filled in with the expansion of when
|
time_t soup_mktime_utc (struct tm *tm);
Converts tm
to a time_t. Unlike with mktime()
, tm
is interpreted
as being a UTC time.
|
the UTC time |
Returns : |
tm as a time_t
|
char* soup_header_param_copy_token (GHashTable *tokens, char *t);
|
|
|
|
Returns : |
GHashTable* soup_header_param_parse_list (const char *header);
|
|
Returns : |
gboolean soup_headers_parse_request (const char *str, int len, GHashTable *dest, char **req_method, char **req_path, SoupHttpVersion *ver);
Parses the headers of an HTTP request in str
and stores the
results in req_method
, req_path
, ver
, and dest
.
Beware that dest
may be modified even on failure.
|
the header string (including the trailing blank line) |
|
length of str up to (but not including) the terminating blank line.
|
|
GHashTable to store the header values in |
|
if non-NULL , will be filled in with the request method
|
|
if non-NULL , will be filled in with the request path
|
|
if non-NULL , will be filled in with the HTTP version
|
Returns : |
success or failure. |
gboolean soup_headers_parse_response (const char *str, int len, GHashTable *dest, SoupHttpVersion *ver, guint *status_code, char **reason_phrase);
Parses the headers of an HTTP response in str
and stores the
results in ver
, status_code
, reason_phrase
, and dest
.
Beware that dest
may be modified even on failure.
|
the header string (including the trailing blank line) |
|
length of str up to (but not including) the terminating blank line.
|
|
GHashTable to store the header values in |
|
if non-NULL , will be filled in with the HTTP version
|
|
if non-NULL , will be filled in with the status code
|
|
if non-NULL , will be filled in with the reason
phrase
|
Returns : |
success or failure. |
gboolean soup_headers_parse_status_line (const char *status_line, SoupHttpVersion *ver, guint *status_code, char **reason_phrase);
Parses the HTTP Status-Line string in status_line
into ver
,
status_code
, and reason_phrase
. status_line
must be terminated by
either "\0" or "\r\n".
gboolean soup_str_case_equal (gconstpointer v1, gconstpointer v2);
Compares v1
and v2
in a case-insensitive manner
|
an ASCII string |
|
another ASCII string |
Returns : |
TRUE if they are equal (modulo case)
|
guint soup_str_case_hash (gconstpointer key);
Hashes key
in a case-insensitive manner.
|
ASCII string to hash |
Returns : |
the hash code. |
xmlNode* soup_xml_real_node (xmlNode *node);
Finds the first "real" node (ie, not a comment or whitespace) at or
after node
at its level in the tree.
Return: a node, or NULL
|
an xmlNodePtr
|
Returns : |