/** * soup_form_encode: * @first_field: name of the first form field * @...: value of @first_field, followed by additional field names * and values, terminated by %NULL. * * Encodes the given field names and values into a value of type * "application/x-www-form-urlencoded", as defined in the HTML 4.01 * spec. * * This method requires you to know the names of the form fields (or * at the very least, the total number of fields) at compile time; for * working with dynamic forms, use soup_form_encode_hash() or * soup_form_encode_datalist(). * * Return value: the encoded form **/ char * soup_form_encode (const char *first_field, ...) { va_list args; char *encoded; va_start (args, first_field); encoded = soup_form_encode_valist (first_field, args); va_end (args); return encoded; }
/** * soup_uri_set_query_from_fields: * @uri: a #SoupURI * @first_field: name of the first form field to encode into query * @...: value of @first_field, followed by additional field names * and values, terminated by %NULL. * * Sets @uri's query to the result of encoding the given form fields * and values according to the * HTML form rules. See * soup_form_encode() for more information. **/ void soup_uri_set_query_from_fields (SoupURI *uri, const char *first_field, ...) { va_list args; g_free (uri->query); va_start (args, first_field); uri->query = soup_form_encode_valist (first_field, args); va_end (args); }
/** * 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); }