After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 704105 - Hard to access SoupMessageBody with introspection
Hard to access SoupMessageBody with introspection
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: API
unspecified
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2013-07-12 15:33 UTC by Daniel Drake
Modified: 2013-11-17 14:49 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Daniel Drake 2013-07-12 15:33:42 UTC
It is hard to use SugarMessageBody with introspection, e.g. from python.
The data itself is exposed in the struct:

typedef struct {
	const char *data;
	goffset     length;
} SoupMessageBody;

However there is currently no way to produce an annotation for this that says "data is a byte array with length length". Instead data is interpreted as a NULL-terminated string, which is wrong.

I believe the norm here would be to provide an API to get at the data. There is actually a way of doing that, so maybe this bug could be closed simply by mentioning it in the documentation: call soup_message_body_flatten() to convert the body into a SoupBuffer then use soup_buffer_get_as_bytes().
Comment 1 Dan Winship 2013-07-12 16:04:39 UTC
hm... we could add GBytes-valued properties to SoupMessage too, and save a few steps. "request-body-data" and "response-body-data" perhaps
Comment 2 Dan Winship 2013-11-17 14:49:43 UTC
added GBytes-valued request_body_data and response_body_data properties