[libsoup/wip/xclaesse/xmlrpc: 4/10] xmlrpc: Add soup_xmlrpc_message_set_fault()
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/wip/xclaesse/xmlrpc: 4/10] xmlrpc: Add soup_xmlrpc_message_set_fault()
- Date: Tue, 23 Jun 2015 14:47:25 +0000 (UTC)
commit b66fd99ba771c4a8d766aaac55a95a8191cf17ec
Author: Xavier Claessens <xavier claessens collabora com>
Date: Sat Jun 13 12:12:34 2015 -0400
xmlrpc: Add soup_xmlrpc_message_set_fault()
This is an alias for soup_xmlrpc_set_fault() for naming
consistency.
https://bugzilla.gnome.org/show_bug.cgi?id=746495
docs/reference/libsoup-2.4-sections.txt | 2 ++
libsoup/libsoup-2.4.sym | 1 +
libsoup/soup-xmlrpc-variant.h | 4 ++++
libsoup/soup-xmlrpc.c | 25 +++++++++++++++++++++++++
4 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/libsoup-2.4-sections.txt b/docs/reference/libsoup-2.4-sections.txt
index 391c0a1..c7312b8 100644
--- a/docs/reference/libsoup-2.4-sections.txt
+++ b/docs/reference/libsoup-2.4-sections.txt
@@ -839,6 +839,7 @@ soup_xmlrpc_build_response
soup_xmlrpc_message_set_response
soup_xmlrpc_build_fault
soup_xmlrpc_set_fault
+soup_xmlrpc_message_set_fault
<SUBSECTION>
SOUP_XMLRPC_FAULT
SoupXMLRPCFault
@@ -852,6 +853,7 @@ soup_xmlrpc_parse_method_call
soup_xmlrpc_extract_method_call
soup_xmlrpc_build_method_response
soup_xmlrpc_set_response
+soup_xmlrpc_set_fault
<SUBSECTION Private>
soup_xmlrpc_error_quark
SOUP_XMLRPC_ERROR
diff --git a/libsoup/libsoup-2.4.sym b/libsoup/libsoup-2.4.sym
index 472f64f..eacd2d5 100644
--- a/libsoup/libsoup-2.4.sym
+++ b/libsoup/libsoup-2.4.sym
@@ -552,6 +552,7 @@ soup_xmlrpc_extract_method_response
soup_xmlrpc_fault_get_type
soup_xmlrpc_fault_quark
soup_xmlrpc_message_new
+soup_xmlrpc_message_set_fault
soup_xmlrpc_message_set_response
soup_xmlrpc_new_custom
soup_xmlrpc_new_datetime
diff --git a/libsoup/soup-xmlrpc-variant.h b/libsoup/soup-xmlrpc-variant.h
index a564133..c7d5c34 100644
--- a/libsoup/soup-xmlrpc-variant.h
+++ b/libsoup/soup-xmlrpc-variant.h
@@ -44,6 +44,10 @@ gchar *soup_xmlrpc_build_response (GVariant *value,
gboolean soup_xmlrpc_message_set_response (SoupMessage *msg,
GVariant *value,
GError **error);
+void soup_xmlrpc_message_set_fault (SoupMessage *msg,
+ gint fault_code,
+ const gchar *fault_format,
+ ...) G_GNUC_PRINTF (3, 4);
/* Utils */
GVariant *soup_xmlrpc_new_custom (const gchar *type,
diff --git a/libsoup/soup-xmlrpc.c b/libsoup/soup-xmlrpc.c
index ee61da1..493fca9 100644
--- a/libsoup/soup-xmlrpc.c
+++ b/libsoup/soup-xmlrpc.c
@@ -424,7 +424,32 @@ soup_xmlrpc_set_fault (SoupMessage *msg, int fault_code,
body, strlen (body));
}
+/**
+ * soup_xmlrpc_message_set_fault:
+ * @msg: an XML-RPC request
+ * @fault_code: the fault code
+ * @fault_format: a printf()-style format string
+ * @...: the parameters to @fault_format
+ *
+ * Sets the status code and response body of @msg to indicate an
+ * unsuccessful XML-RPC call, with the error described by @fault_code
+ * and @fault_format.
+ **/
+void
+soup_xmlrpc_message_set_fault (SoupMessage *msg, int fault_code,
+ const char *fault_format, ...)
+{
+ va_list args;
+ char *body;
+ va_start (args, fault_format);
+ body = soup_xmlrpc_build_faultv (fault_code, fault_format, args);
+ va_end (args);
+
+ soup_message_set_status (msg, SOUP_STATUS_OK);
+ soup_message_set_response (msg, "text/xml", SOUP_MEMORY_TAKE,
+ body, strlen (body));
+}
static gboolean
parse_value (xmlNode *xmlvalue, GValue *value)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]