[libsoup] Add properties for request/response body/headers
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] Add properties for request/response body/headers
- Date: Thu, 29 Apr 2010 00:50:38 +0000 (UTC)
commit 4bb1a311e44b58b0886260440e75081df3a9ba94
Author: Dan Winship <danw gnome org>
Date: Wed Jul 8 15:19:10 2009 -0400
Add properties for request/response body/headers
For use with gobject-introspection in bindings that can't read fields
directly.
Patch from Colin Walters. http://bugzilla.gnome.org/show_bug.cgi?id=551441
libsoup/soup-message.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++-
libsoup/soup-message.h | 20 ++++++++-----
2 files changed, 80 insertions(+), 9 deletions(-)
---
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c
index 4738c76..160a0bd 100644
--- a/libsoup/soup-message.c
+++ b/libsoup/soup-message.c
@@ -120,6 +120,10 @@ enum {
PROP_STATUS_CODE,
PROP_REASON_PHRASE,
PROP_FIRST_PARTY,
+ PROP_REQUEST_BODY,
+ PROP_REQUEST_HEADERS,
+ PROP_RESPONSE_BODY,
+ PROP_RESPONSE_HEADERS,
LAST_PROP
};
@@ -579,7 +583,6 @@ soup_message_class_init (SoupMessageClass *message_class)
"The HTTP response reason phrase",
NULL,
G_PARAM_READWRITE));
-
/**
* SOUP_MESSAGE_FIRST_PARTY:
*
@@ -594,6 +597,58 @@ soup_message_class_init (SoupMessageClass *message_class)
"The URI loaded in the application when the message was requested.",
SOUP_TYPE_URI,
G_PARAM_READWRITE));
+ /**
+ * SOUP_MESSAGE_REQUEST_BODY:
+ *
+ * Alias for the #SoupMessage:request-body property. (The
+ * message's HTTP request body.)
+ **/
+ g_object_class_install_property (
+ object_class, PROP_REQUEST_BODY,
+ g_param_spec_boxed (SOUP_MESSAGE_REQUEST_BODY,
+ "Request Body",
+ "The HTTP request content",
+ SOUP_TYPE_MESSAGE_BODY,
+ G_PARAM_READABLE));
+ /**
+ * SOUP_MESSAGE_REQUEST_HEADERS:
+ *
+ * Alias for the #SoupMessage:request-headers property. (The
+ * message's HTTP request headers.)
+ **/
+ g_object_class_install_property (
+ object_class, PROP_REQUEST_HEADERS,
+ g_param_spec_boxed (SOUP_MESSAGE_REQUEST_HEADERS,
+ "Request Headers",
+ "The HTTP request headers",
+ SOUP_TYPE_MESSAGE_HEADERS,
+ G_PARAM_READABLE));
+ /**
+ * SOUP_MESSAGE_RESPONSE_BODY:
+ *
+ * Alias for the #SoupMessage:response-body property. (The
+ * message's HTTP response body.)
+ **/
+ g_object_class_install_property (
+ object_class, PROP_RESPONSE_BODY,
+ g_param_spec_boxed (SOUP_MESSAGE_RESPONSE_BODY,
+ "Response Body",
+ "The HTTP response content",
+ SOUP_TYPE_MESSAGE_BODY,
+ G_PARAM_READABLE));
+ /**
+ * SOUP_MESSAGE_RESPONSE_HEADERS:
+ *
+ * Alias for the #SoupMessage:response-headers property. (The
+ * message's HTTP response headers.)
+ **/
+ g_object_class_install_property (
+ object_class, PROP_RESPONSE_HEADERS,
+ g_param_spec_boxed (SOUP_MESSAGE_RESPONSE_HEADERS,
+ "Response Headers",
+ "The HTTP response headers",
+ SOUP_TYPE_MESSAGE_HEADERS,
+ G_PARAM_READABLE));
}
static void
@@ -671,6 +726,18 @@ get_property (GObject *object, guint prop_id,
case PROP_FIRST_PARTY:
g_value_set_boxed (value, priv->first_party);
break;
+ case PROP_REQUEST_BODY:
+ g_value_set_boxed (value, msg->request_body);
+ break;
+ case PROP_REQUEST_HEADERS:
+ g_value_set_boxed (value, msg->request_headers);
+ break;
+ case PROP_RESPONSE_BODY:
+ g_value_set_boxed (value, msg->response_body);
+ break;
+ case PROP_RESPONSE_HEADERS:
+ g_value_set_boxed (value, msg->response_headers);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
diff --git a/libsoup/soup-message.h b/libsoup/soup-message.h
index 3f3ee14..4f2d66d 100644
--- a/libsoup/soup-message.h
+++ b/libsoup/soup-message.h
@@ -60,14 +60,18 @@ typedef struct {
GType soup_message_get_type (void);
-#define SOUP_MESSAGE_METHOD "method"
-#define SOUP_MESSAGE_URI "uri"
-#define SOUP_MESSAGE_HTTP_VERSION "http-version"
-#define SOUP_MESSAGE_FLAGS "flags"
-#define SOUP_MESSAGE_SERVER_SIDE "server-side"
-#define SOUP_MESSAGE_STATUS_CODE "status-code"
-#define SOUP_MESSAGE_REASON_PHRASE "reason-phrase"
-#define SOUP_MESSAGE_FIRST_PARTY "first-party"
+#define SOUP_MESSAGE_METHOD "method"
+#define SOUP_MESSAGE_URI "uri"
+#define SOUP_MESSAGE_HTTP_VERSION "http-version"
+#define SOUP_MESSAGE_FLAGS "flags"
+#define SOUP_MESSAGE_SERVER_SIDE "server-side"
+#define SOUP_MESSAGE_STATUS_CODE "status-code"
+#define SOUP_MESSAGE_REASON_PHRASE "reason-phrase"
+#define SOUP_MESSAGE_FIRST_PARTY "first-party"
+#define SOUP_MESSAGE_REQUEST_BODY "request-body"
+#define SOUP_MESSAGE_REQUEST_HEADERS "request-headers"
+#define SOUP_MESSAGE_RESPONSE_BODY "response-body"
+#define SOUP_MESSAGE_RESPONSE_HEADERS "response-headers"
SoupMessage *soup_message_new (const char *method,
const char *uri_string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]