summaryrefslogtreecommitdiff
path: root/libsoup/soup-form.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsoup/soup-form.c')
-rw-r--r--libsoup/soup-form.c142
1 files changed, 0 insertions, 142 deletions
diff --git a/libsoup/soup-form.c b/libsoup/soup-form.c
index 23cd007e..c0391444 100644
--- a/libsoup/soup-form.c
+++ b/libsoup/soup-form.c
@@ -346,145 +346,3 @@ soup_form_encode_valist (const char *first_field, va_list args)
return g_string_free (str, FALSE);
}
-
-static SoupMessage *
-soup_form_request_for_data (const char *method, const char *uri_string,
- char *form_data)
-{
- SoupMessage *msg;
- SoupURI *uri;
-
- uri = soup_uri_new (uri_string);
- if (!uri)
- return NULL;
-
- if (!strcmp (method, "GET")) {
- g_free (uri->query);
- uri->query = form_data;
-
- msg = soup_message_new_from_uri (method, uri);
- } else if (!strcmp (method, "POST") || !strcmp (method, "PUT")) {
- GBytes *body;
-
- msg = soup_message_new_from_uri (method, uri);
-
- body = g_bytes_new_take (form_data, strlen (form_data));
- soup_message_set_request_body_from_bytes (msg, SOUP_FORM_MIME_TYPE_URLENCODED, body);
- g_bytes_unref (body);
- } else {
- g_warning ("invalid method passed to soup_form_request_new");
- g_free (form_data);
-
- /* Don't crash */
- msg = soup_message_new_from_uri (method, uri);
- }
- soup_uri_free (uri);
-
- return msg;
-}
-
-/**
- * soup_form_request_new:
- * @method: the HTTP method, either "GET" or "POST"
- * @uri: the URI to send the form data to
- * @first_field: name of the first form field
- * @...: value of @first_field, followed by additional field names
- * and values, terminated by %NULL.
- *
- * Creates a new %SoupMessage and sets it up to send the given data
- * to @uri via @method. (That is, if @method is "GET", it will encode
- * the form data into @uri's query field, and if @method is "POST", it
- * will encode it into the %SoupMessage's request_body.)
- *
- * Return value: (transfer full): the new %SoupMessage
- **/
-SoupMessage *
-soup_form_request_new (const char *method, const char *uri,
- const char *first_field, ...)
-{
- va_list args;
- char *form_data;
-
- va_start (args, first_field);
- form_data = soup_form_encode_valist (first_field, args);
- va_end (args);
-
- return soup_form_request_for_data (method, uri, form_data);
-}
-
-/**
- * soup_form_request_new_from_hash:
- * @method: the HTTP method, either "GET" or "POST"
- * @uri: the URI to send the form data to
- * @form_data_set: (element-type utf8 utf8): the data to send to @uri
- *
- * Creates a new %SoupMessage and sets it up to send @form_data_set to
- * @uri via @method, as with soup_form_request_new().
- *
- * Return value: (transfer full): the new %SoupMessage
- **/
-SoupMessage *
-soup_form_request_new_from_hash (const char *method, const char *uri,
- GHashTable *form_data_set)
-{
- return soup_form_request_for_data (
- method, uri, soup_form_encode_hash (form_data_set));
-}
-
-/**
- * soup_form_request_new_from_datalist:
- * @method: the HTTP method, either "GET" or "POST"
- * @uri: the URI to send the form data to
- * @form_data_set: the data to send to @uri
- *
- * Creates a new %SoupMessage and sets it up to send @form_data_set to
- * @uri via @method, as with soup_form_request_new().
- *
- * Return value: (transfer full): the new %SoupMessage
- **/
-SoupMessage *
-soup_form_request_new_from_datalist (const char *method, const char *uri,
- GData **form_data_set)
-{
- return soup_form_request_for_data (
- method, uri, soup_form_encode_datalist (form_data_set));
-}
-
-/**
- * soup_form_request_new_from_multipart:
- * @uri: the URI to send the form data to
- * @multipart: a "multipart/form-data" #SoupMultipart
- *
- * Creates a new %SoupMessage and sets it up to send @multipart to
- * @uri via POST.
- *
- * To send a <literal>"multipart/form-data"</literal> POST, first
- * create a #SoupMultipart, using %SOUP_FORM_MIME_TYPE_MULTIPART as
- * the MIME type. Then use soup_multipart_append_form_string() and
- * soup_multipart_append_form_file() to add the value of each form
- * control to the multipart. (These are just convenience methods, and
- * you can use soup_multipart_append_part() if you need greater
- * control over the part headers.) Finally, call
- * soup_form_request_new_from_multipart() to serialize the multipart
- * structure and create a #SoupMessage.
- *
- * Return value: (transfer full): the new %SoupMessage
- *
- * Since: 2.26
- **/
-SoupMessage *
-soup_form_request_new_from_multipart (const char *uri,
- SoupMultipart *multipart)
-{
- SoupMessage *msg;
- GBytes *body = NULL;
-
- msg = soup_message_new ("POST", uri);
- soup_multipart_to_message (multipart, soup_message_get_request_headers (msg), &body);
- soup_message_set_request_body_from_bytes (msg,
- soup_message_headers_get_content_type (soup_message_get_request_headers (msg), NULL),
- body);
- g_bytes_unref (body);
-
- return msg;
-}