diff options
author | Dan Winship <danw@gnome.org> | 2013-11-17 09:23:08 -0500 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2013-11-17 09:23:08 -0500 |
commit | 0f22a7505ae2e41e2a9e17854d9bd362f5a72945 (patch) | |
tree | 50348f3e2905263bb5dbe172cf39e25a761598fe | |
parent | a241493298bc87748a79fdfaa7e7f1d657906065 (diff) | |
download | libsoup-0f22a7505ae2e41e2a9e17854d9bd362f5a72945.tar.gz |
soup-message: minor fixups to soup_message_set_request/response_body()
g_warn_if_fail() if the Content-Type is invalid, and impove the
annotations.
https://bugzilla.gnome.org/show_bug.cgi?id=686766
-rw-r--r-- | libsoup/soup-message.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c index 76130436..b51f234e 100644 --- a/libsoup/soup-message.c +++ b/libsoup/soup-message.c @@ -5,6 +5,8 @@ * Copyright (C) 2000-2003, Ximian, Inc. */ +#include <string.h> + #include "soup-message.h" #include "soup.h" #include "soup-connection.h" @@ -936,9 +938,10 @@ soup_message_new_from_uri (const char *method, SoupURI *uri) /** * soup_message_set_request: * @msg: the message - * @content_type: MIME Content-Type of the body + * @content_type: (allow-none): MIME Content-Type of the body * @req_use: a #SoupMemoryUse describing how to handle @req_body - * @req_body: a data buffer containing the body of the message request. + * @req_body: (allow-none) (array length=req_length) (element-type guint8): + * a data buffer containing the body of the message request. * @req_length: the byte length of @req_body. * * Convenience function to set the request body of a #SoupMessage. If @@ -955,6 +958,8 @@ soup_message_set_request (SoupMessage *msg, g_return_if_fail (content_type != NULL || req_length == 0); if (content_type) { + g_warn_if_fail (strchr (content_type, '/') != NULL); + soup_message_headers_replace (msg->request_headers, "Content-Type", content_type); soup_message_body_append (msg->request_body, req_use, @@ -971,8 +976,8 @@ soup_message_set_request (SoupMessage *msg, * @msg: the message * @content_type: (allow-none): MIME Content-Type of the body * @resp_use: a #SoupMemoryUse describing how to handle @resp_body - * @resp_body: (array length=resp_length) (element-type guint8): a data buffer - * containing the body of the message response. + * @resp_body: (allow-none) (array length=resp_length) (element-type guint8): + * a data buffer containing the body of the message response. * @resp_length: the byte length of @resp_body. * * Convenience function to set the response body of a #SoupMessage. If @@ -989,6 +994,8 @@ soup_message_set_response (SoupMessage *msg, g_return_if_fail (content_type != NULL || resp_length == 0); if (content_type) { + g_warn_if_fail (strchr (content_type, '/') != NULL); + soup_message_headers_replace (msg->response_headers, "Content-Type", content_type); soup_message_body_append (msg->response_body, resp_use, |