[libsoup/new-io] add content-length and content-type attributes to SoupRequest



commit 374dc3cad85c0fc12217567b2c2da48d09a144a0
Author: Dan Winship <danw gnome org>
Date:   Sun Dec 20 18:42:57 2009 +0100

    add content-length and content-type attributes to SoupRequest

 libsoup/soup-request-data.c |  101 ++++++++++++++++++------------
 libsoup/soup-request-data.h |    3 +
 libsoup/soup-request-file.c |  142 ++++++++++++++++++++++++++++++------------
 libsoup/soup-request-ftp.c  |  104 +++++++++++++++++++------------
 libsoup/soup-request-http.c |   69 +++++++++++----------
 libsoup/soup-request.c      |   12 ++++
 libsoup/soup-request.h      |   32 ++++++----
 7 files changed, 294 insertions(+), 169 deletions(-)
---
diff --git a/libsoup/soup-request-data.c b/libsoup/soup-request-data.c
index eb3dd25..7134c04 100644
--- a/libsoup/soup-request-data.c
+++ b/libsoup/soup-request-data.c
@@ -16,27 +16,25 @@
 
 G_DEFINE_TYPE (SoupRequestData, soup_request_data, SOUP_TYPE_REQUEST)
 
-static gboolean soup_request_data_check_uri (SoupRequest  *request,
-					     SoupURI      *uri,
-					     GError      **error);
-
-static GInputStream *soup_request_data_send (SoupRequest   *request,
-					     GCancellable  *cancellable,
-					     GError       **error);
+struct _SoupRequestDataPrivate {
+	gsize content_length;
+	char *content_type;
+};
 
 static void
-soup_request_data_class_init (SoupRequestDataClass *request_data_class)
+soup_request_data_init (SoupRequestData *data)
 {
-	SoupRequestClass *request_class =
-		SOUP_REQUEST_CLASS (request_data_class);
-
-	request_class->check_uri = soup_request_data_check_uri;
-	request_class->send = soup_request_data_send;
+	data->priv = G_TYPE_INSTANCE_GET_PRIVATE (data, SOUP_TYPE_REQUEST_DATA, SoupRequestDataPrivate);
 }
 
 static void
-soup_request_data_init (SoupRequestData *data)
+soup_request_data_finalize (GObject *object)
 {
+	SoupRequestData *data = SOUP_REQUEST_DATA (object);
+
+	g_free (data->priv->content_type);
+
+	G_OBJECT_CLASS (soup_request_data_parent_class)->finalize (object);
 }
 
 static gboolean
@@ -48,25 +46,25 @@ soup_request_data_check_uri (SoupRequest  *request,
 }
 
 static GInputStream *
-data_uri_decode (const char  *uri_data,
-		 char       **mime_type)
+soup_request_data_send (SoupRequest   *request,
+			GCancellable  *cancellable,
+			GError       **error)
 {
+	SoupRequestData *data = SOUP_REQUEST_DATA (request);
+	SoupURI *uri = soup_request_get_uri (request);
 	GInputStream *memstream;
 	const char *comma, *semi, *start, *end;
 	gboolean base64 = FALSE;
 
-	if (mime_type)
-		*mime_type = NULL;
-
-	comma = strchr (uri_data, ',');
-	if (comma && comma != uri_data) {
+	comma = strchr (uri->path, ',');
+	if (comma && comma != uri->path) {
 		/* Deal with MIME type / params */
-		semi = memchr (uri_data, ';', comma - uri_data);
+		semi = memchr (uri->path, ';', comma - uri->path);
 		end = semi ? semi : comma;
 
-		if (mime_type && (end != uri_data)) {
-			char *encoded = g_strndup (uri_data, end - uri_data);
-			*mime_type = soup_uri_decode (encoded);
+		if (end != uri->path) {
+			char *encoded = g_strndup (uri->path, end - uri->path);
+			data->priv->content_type = soup_uri_decode (encoded);
 			g_free (encoded);
 		}
 
@@ -76,10 +74,9 @@ data_uri_decode (const char  *uri_data,
 
 	memstream = g_memory_input_stream_new ();
 
-	start = comma ? comma + 1 : uri_data;
+	start = comma ? comma + 1 : uri->path;
 	if (*start) {
 		guchar *buf;
-		gsize len;
 
 		if (base64) {
 			int inlen, state = 0;
@@ -95,8 +92,9 @@ data_uri_decode (const char  *uri_data,
 
 			inlen = strlen (start);
 			buf = g_malloc (inlen * 3 / 4);  
-			len = g_base64_decode_step (start, inlen, buf,
-						    &state, &save);
+			data->priv->content_length =
+				g_base64_decode_step (start, inlen, buf,
+						      &state, &save);
 			g_free (unescaped);
 			if (state != 0) {
 				g_free (buf);
@@ -106,30 +104,51 @@ data_uri_decode (const char  *uri_data,
 			buf = (guchar *)g_uri_unescape_string (start, NULL);
 			if (!buf)
 				goto fail;
-			len = strlen ((char *)buf);
+			data->priv->content_length = strlen ((char *)buf);
 		}
 
 		g_memory_input_stream_add_data (G_MEMORY_INPUT_STREAM (memstream),
-						buf, len, g_free);
+						buf, data->priv->content_length,
+						g_free);
 	}
 
 	return memstream;
 
 fail:
 	g_object_unref (memstream);
-	if (mime_type && *mime_type) {
-		g_free (*mime_type);
-		*mime_type = NULL;
-	}
 	return NULL;
 }
 
-static GInputStream *
-soup_request_data_send (SoupRequest   *request,
-			GCancellable  *cancellable,
-			GError       **error)
+static goffset
+soup_request_data_get_content_length (SoupRequest *request)
 {
-	SoupURI *uri = soup_request_get_uri (request);
+	SoupRequestData *data = SOUP_REQUEST_DATA (request);
+
+	return data->priv->content_length;
+}
+
+static const char *
+soup_request_data_get_content_type (SoupRequest *request)
+{
+	SoupRequestData *data = SOUP_REQUEST_DATA (request);
 
-	return data_uri_decode (uri->path, NULL);
+	return data->priv->content_type;
 }
+
+static void
+soup_request_data_class_init (SoupRequestDataClass *request_data_class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (request_data_class);
+	SoupRequestClass *request_class =
+		SOUP_REQUEST_CLASS (request_data_class);
+
+	g_type_class_add_private (request_data_class, sizeof (SoupRequestDataPrivate));
+
+	object_class->finalize = soup_request_data_finalize;
+
+	request_class->check_uri = soup_request_data_check_uri;
+	request_class->send = soup_request_data_send;
+	request_class->get_content_length = soup_request_data_get_content_length;
+	request_class->get_content_type = soup_request_data_get_content_type;
+}
+
diff --git a/libsoup/soup-request-data.h b/libsoup/soup-request-data.h
index 238d5b2..dd580f5 100644
--- a/libsoup/soup-request-data.h
+++ b/libsoup/soup-request-data.h
@@ -15,9 +15,12 @@
 #define SOUP_IS_REQUEST_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOUP_TYPE_REQUEST_DATA))
 #define SOUP_REQUEST_DATA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_REQUEST_DATA, SoupRequestDataClass))
 
+typedef struct _SoupRequestDataPrivate SoupRequestDataPrivate;
+
 typedef struct {
 	SoupRequest parent;
 
+	SoupRequestDataPrivate *priv;
 } SoupRequestData;
 
 typedef struct {
diff --git a/libsoup/soup-request-file.c b/libsoup/soup-request-file.c
index 6a735dd..ca8890e 100644
--- a/libsoup/soup-request-file.c
+++ b/libsoup/soup-request-file.c
@@ -18,41 +18,11 @@ G_DEFINE_TYPE (SoupRequestFile, soup_request_file, SOUP_TYPE_REQUEST)
 
 struct _SoupRequestFilePrivate {
 	GFile *gfile;
-};
-
-static void soup_request_file_finalize (GObject *object);
-
-static gboolean soup_request_file_check_uri (SoupRequest  *request,
-					     SoupURI      *uri,
-					     GError      **error);
-
-static GInputStream *soup_request_file_send        (SoupRequest          *request,
-						    GCancellable         *cancellable,
-						    GError              **error);
-static void          soup_request_file_send_async  (SoupRequest          *request,
-						    GCancellable         *cancellable,
-						    GAsyncReadyCallback   callback,
-						    gpointer              user_data);
-static GInputStream *soup_request_file_send_finish (SoupRequest          *request,
-						    GAsyncResult         *result,
-						    GError              **error);
-
-static void
-soup_request_file_class_init (SoupRequestFileClass *request_file_class)
-{
-	GObjectClass *object_class = G_OBJECT_CLASS (request_file_class);
-	SoupRequestClass *request_class =
-		SOUP_REQUEST_CLASS (request_file_class);
+	GFileInfo *info;
 
-	g_type_class_add_private (request_file_class, sizeof (SoupRequestFilePrivate));
-
-	object_class->finalize = soup_request_file_finalize;
-
-	request_class->check_uri = soup_request_file_check_uri;
-	request_class->send = soup_request_file_send;
-	request_class->send_async = soup_request_file_send_async;
-	request_class->send_finish = soup_request_file_send_finish;
-}
+	GSimpleAsyncResult *simple;
+	GCancellable *cancellable;
+};
 
 static void
 soup_request_file_init (SoupRequestFile *file)
@@ -67,6 +37,8 @@ soup_request_file_finalize (GObject *object)
 
 	if (file->priv->gfile)
 		g_object_unref (file->priv->gfile);
+	if (file->priv->info)
+		g_object_unref (file->priv->info);
 
 	G_OBJECT_CLASS (soup_request_file_parent_class)->finalize (object);
 }
@@ -101,6 +73,14 @@ soup_request_file_send (SoupRequest          *request,
 {
 	SoupRequestFile *file = SOUP_REQUEST_FILE (request);
 
+	file->priv->info = g_file_query_info (file->priv->gfile,
+					      G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+					      G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+					      G_FILE_ATTRIBUTE_STANDARD_SIZE,
+					      0, cancellable, error);
+	if (!file->priv->info)
+		return NULL;
+
 	return (GInputStream *)g_file_read (file->priv->gfile, cancellable, error);
 }
 
@@ -108,10 +88,18 @@ static void
 sent_async (GObject *source, GAsyncResult *result, gpointer user_data)
 {
 	GFile *gfile = G_FILE (source);
-	GSimpleAsyncResult *simple = user_data;
+	SoupRequestFile *file = user_data;
+	GSimpleAsyncResult *simple;
 	GError *error = NULL;
 	GFileInputStream *istream;
 
+	simple = file->priv->simple;
+	file->priv->simple = NULL;
+	if (file->priv->cancellable) {
+		g_object_unref (file->priv->cancellable);
+		file->priv->cancellable = NULL;
+	}
+
 	istream = g_file_read_finish (gfile, result, &error);
 	if (istream)
 		g_simple_async_result_set_op_res_gpointer (simple, istream, g_object_unref);
@@ -124,19 +112,52 @@ sent_async (GObject *source, GAsyncResult *result, gpointer user_data)
 }
 
 static void
+queried_info_async (GObject *source, GAsyncResult *result, gpointer user_data)
+{
+	GFile *gfile = G_FILE (source);
+	SoupRequestFile *file = user_data;
+	GError *error = NULL;
+
+	file->priv->info = g_file_query_info_finish (gfile, result, &error);
+	if (!file->priv->info) {
+		GSimpleAsyncResult *simple;
+
+		simple = file->priv->simple;
+		file->priv->simple = NULL;
+		if (file->priv->cancellable) {
+			g_object_unref (file->priv->cancellable);
+			file->priv->cancellable = NULL;
+		}
+
+		g_simple_async_result_set_from_error (simple, error);
+		g_error_free (error);
+		g_simple_async_result_complete (simple);
+		g_object_unref (simple);
+		return;
+	}
+	
+	g_file_read_async (gfile, G_PRIORITY_DEFAULT,
+			   file->priv->cancellable, sent_async, file);
+}
+
+static void
 soup_request_file_send_async (SoupRequest          *request,
 			      GCancellable         *cancellable,
 			      GAsyncReadyCallback   callback,
 			      gpointer              user_data)
 {
 	SoupRequestFile *file = SOUP_REQUEST_FILE (request);
-	GSimpleAsyncResult *simple;
 
-	simple = g_simple_async_result_new (G_OBJECT (request),
-					    callback, user_data,
-					    soup_request_file_send_async);
-	g_file_read_async (file->priv->gfile, G_PRIORITY_DEFAULT,
-			   cancellable, sent_async, simple);
+	file->priv->simple = g_simple_async_result_new (G_OBJECT (request),
+							callback, user_data,
+							soup_request_file_send_async);
+	file->priv->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
+	g_file_query_info_async (file->priv->gfile,
+				 G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+				 G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+				 G_FILE_ATTRIBUTE_STANDARD_SIZE,
+				 0, G_PRIORITY_DEFAULT, cancellable,
+				 queried_info_async, file);
 }
 
 static GInputStream *
@@ -153,3 +174,42 @@ soup_request_file_send_finish (SoupRequest          *request,
 		return NULL;
 	return g_object_ref (g_simple_async_result_get_op_res_gpointer (simple));
 }
+
+static goffset
+soup_request_file_get_content_length (SoupRequest *request)
+{
+	SoupRequestFile *file = SOUP_REQUEST_FILE (request);
+
+	g_return_val_if_fail (file->priv->info != NULL, -1);
+
+	return g_file_info_get_size (file->priv->info);
+}
+
+static const char *
+soup_request_file_get_content_type (SoupRequest *request)
+{
+	SoupRequestFile *file = SOUP_REQUEST_FILE (request);
+
+	g_return_val_if_fail (file->priv->info != NULL, NULL);
+
+	return g_file_info_get_content_type (file->priv->info);
+}
+
+static void
+soup_request_file_class_init (SoupRequestFileClass *request_file_class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (request_file_class);
+	SoupRequestClass *request_class =
+		SOUP_REQUEST_CLASS (request_file_class);
+
+	g_type_class_add_private (request_file_class, sizeof (SoupRequestFilePrivate));
+
+	object_class->finalize = soup_request_file_finalize;
+
+	request_class->check_uri = soup_request_file_check_uri;
+	request_class->send = soup_request_file_send;
+	request_class->send_async = soup_request_file_send_async;
+	request_class->send_finish = soup_request_file_send_finish;
+	request_class->get_content_length = soup_request_file_get_content_length;
+	request_class->get_content_type = soup_request_file_get_content_type;
+}
diff --git a/libsoup/soup-request-ftp.c b/libsoup/soup-request-ftp.c
index c14ce9a..7a9ba37 100644
--- a/libsoup/soup-request-ftp.c
+++ b/libsoup/soup-request-ftp.c
@@ -19,42 +19,9 @@ G_DEFINE_TYPE (SoupRequestFTP, soup_request_ftp, SOUP_TYPE_REQUEST)
 
 struct _SoupRequestFTPPrivate {
 	SoupFTPConnection *conn;
+	GFileInfo *info;
 };
 
-static void soup_request_ftp_finalize (GObject *object);
-
-static gboolean soup_request_ftp_check_uri (SoupRequest  *request,
-					    SoupURI      *uri,
-					    GError      **error);
-
-static GInputStream *soup_request_ftp_send        (SoupRequest          *request,
-						   GCancellable         *cancellable,
-						   GError              **error);
-static void          soup_request_ftp_send_async  (SoupRequest          *request,
-						   GCancellable         *cancellable,
-						   GAsyncReadyCallback   callback,
-						   gpointer              user_data);
-static GInputStream *soup_request_ftp_send_finish (SoupRequest          *request,
-						   GAsyncResult         *result,
-						   GError              **error);
-
-static void
-soup_request_ftp_class_init (SoupRequestFTPClass *request_ftp_class)
-{
-	GObjectClass *object_class = G_OBJECT_CLASS (request_ftp_class);
-	SoupRequestClass *request_class =
-		SOUP_REQUEST_CLASS (request_ftp_class);
-
-	g_type_class_add_private (request_ftp_class, sizeof (SoupRequestFTPPrivate));
-
-	object_class->finalize = soup_request_ftp_finalize;
-
-	request_class->check_uri = soup_request_ftp_check_uri;
-	request_class->send = soup_request_ftp_send;
-	request_class->send_async = soup_request_ftp_send_async;
-	request_class->send_finish = soup_request_ftp_send_finish;
-}
-
 static void
 soup_request_ftp_init (SoupRequestFTP *ftp)
 {
@@ -77,6 +44,8 @@ soup_request_ftp_finalize (GObject *object)
 
 	if (ftp->priv->conn)
 		g_object_unref (ftp->priv->conn);
+	if (ftp->priv->info)
+		g_object_unref (ftp->priv->info);
 
 	G_OBJECT_CLASS (soup_request_ftp_parent_class)->finalize (object);
 }
@@ -89,11 +58,18 @@ soup_request_ftp_send (SoupRequest          *request,
 		       GError              **error)
 {
 	SoupRequestFTP *ftp = SOUP_REQUEST_FTP (request);
-
-	return soup_ftp_connection_load_uri (ftp->priv->conn,
-					     soup_request_get_uri (request),
-					     cancellable,
-					     error);
+	GInputStream *stream;
+
+	stream = soup_ftp_connection_load_uri (ftp->priv->conn,
+					       soup_request_get_uri (request),
+					       cancellable,
+					       error);
+	if (stream) {
+		g_object_get (G_OBJECT (stream),
+			      "file-info", &ftp->priv->info,
+			      NULL);
+	}
+	return stream;
 }
 
 static void
@@ -138,12 +114,60 @@ soup_request_ftp_send_finish (SoupRequest          *request,
 			      GAsyncResult         *result,
 			      GError              **error)
 {
+	SoupRequestFTP *ftp = SOUP_REQUEST_FTP (request);
 	GSimpleAsyncResult *simple;
+	GInputStream *stream;
 
 	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (request), soup_request_ftp_send_async), NULL);
 
 	simple = G_SIMPLE_ASYNC_RESULT (result);
 	if (g_simple_async_result_propagate_error (simple, error))
 		return NULL;
-	return g_object_ref (g_simple_async_result_get_op_res_gpointer (simple));
+
+	stream = g_object_ref (g_simple_async_result_get_op_res_gpointer (simple));
+	if (stream) {
+		g_object_get (G_OBJECT (stream),
+			      "file-info", &ftp->priv->info,
+			      NULL);
+	}
+	return stream;
+}
+
+static goffset
+soup_request_ftp_get_content_length (SoupRequest *request)
+{
+	SoupRequestFTP *ftp = SOUP_REQUEST_FTP (request);
+
+	g_return_val_if_fail (ftp->priv->info != NULL, -1);
+
+	return g_file_info_get_size (ftp->priv->info);
+}
+
+static const char *
+soup_request_ftp_get_content_type (SoupRequest *request)
+{
+	SoupRequestFTP *ftp = SOUP_REQUEST_FTP (request);
+
+	g_return_val_if_fail (ftp->priv->info != NULL, NULL);
+
+	return g_file_info_get_content_type (ftp->priv->info);
+}
+
+static void
+soup_request_ftp_class_init (SoupRequestFTPClass *request_ftp_class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (request_ftp_class);
+	SoupRequestClass *request_class =
+		SOUP_REQUEST_CLASS (request_ftp_class);
+
+	g_type_class_add_private (request_ftp_class, sizeof (SoupRequestFTPPrivate));
+
+	object_class->finalize = soup_request_ftp_finalize;
+
+	request_class->check_uri = soup_request_ftp_check_uri;
+	request_class->send = soup_request_ftp_send;
+	request_class->send_async = soup_request_ftp_send_async;
+	request_class->send_finish = soup_request_ftp_send_finish;
+	request_class->get_content_length = soup_request_ftp_get_content_length;
+	request_class->get_content_type = soup_request_ftp_get_content_type;
 }
diff --git a/libsoup/soup-request-http.c b/libsoup/soup-request-http.c
index fc34b13..c4ca908 100644
--- a/libsoup/soup-request-http.c
+++ b/libsoup/soup-request-http.c
@@ -22,40 +22,6 @@ struct _SoupRequestHTTPPrivate {
 	SoupMessage *msg;
 };
 
-static void soup_request_http_finalize (GObject *object);
-
-static gboolean soup_request_http_check_uri (SoupRequest  *request,
-					     SoupURI      *uri,
-					     GError      **error);
-
-static GInputStream *soup_request_http_send        (SoupRequest          *request,
-						    GCancellable         *cancellable,
-						    GError              **error);
-static void          soup_request_http_send_async  (SoupRequest          *request,
-						    GCancellable         *cancellable,
-						    GAsyncReadyCallback   callback,
-						    gpointer              user_data);
-static GInputStream *soup_request_http_send_finish (SoupRequest          *request,
-						    GAsyncResult         *result,
-						    GError              **error);
-
-static void
-soup_request_http_class_init (SoupRequestHTTPClass *request_http_class)
-{
-	GObjectClass *object_class = G_OBJECT_CLASS (request_http_class);
-	SoupRequestClass *request_class =
-		SOUP_REQUEST_CLASS (request_http_class);
-
-	g_type_class_add_private (request_http_class, sizeof (SoupRequestHTTPPrivate));
-
-	object_class->finalize = soup_request_http_finalize;
-
-	request_class->check_uri = soup_request_http_check_uri;
-	request_class->send = soup_request_http_send;
-	request_class->send_async = soup_request_http_send_async;
-	request_class->send_finish = soup_request_http_send_finish;
-}
-
 static void
 soup_request_http_init (SoupRequestHTTP *http)
 {
@@ -154,3 +120,38 @@ soup_request_http_send_finish (SoupRequest          *request,
 		return NULL;
 	return g_object_ref (g_simple_async_result_get_op_res_gpointer (simple));
 }
+
+static goffset
+soup_request_http_get_content_length (SoupRequest *request)
+{
+	SoupRequestHTTP *http = SOUP_REQUEST_HTTP (request);
+
+	return soup_message_headers_get_content_length (http->priv->msg->response_headers);
+}
+
+static const char *
+soup_request_http_get_content_type (SoupRequest *request)
+{
+	SoupRequestHTTP *http = SOUP_REQUEST_HTTP (request);
+
+	return soup_message_headers_get_content_type (http->priv->msg->response_headers, NULL);
+}
+
+static void
+soup_request_http_class_init (SoupRequestHTTPClass *request_http_class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (request_http_class);
+	SoupRequestClass *request_class =
+		SOUP_REQUEST_CLASS (request_http_class);
+
+	g_type_class_add_private (request_http_class, sizeof (SoupRequestHTTPPrivate));
+
+	object_class->finalize = soup_request_http_finalize;
+
+	request_class->check_uri = soup_request_http_check_uri;
+	request_class->send = soup_request_http_send;
+	request_class->send_async = soup_request_http_send_async;
+	request_class->send_finish = soup_request_http_send_finish;
+	request_class->get_content_length = soup_request_http_get_content_length;
+	request_class->get_content_type = soup_request_http_get_content_type;
+}
diff --git a/libsoup/soup-request.c b/libsoup/soup-request.c
index 66b0f97..2c90baf 100644
--- a/libsoup/soup-request.c
+++ b/libsoup/soup-request.c
@@ -252,3 +252,15 @@ soup_request_get_session (SoupRequest *request)
 {
 	return request->priv->session;
 }
+
+goffset
+soup_request_get_content_length (SoupRequest *request)
+{
+	return SOUP_REQUEST_GET_CLASS (request)->get_content_length (request);
+}
+
+const char *
+soup_request_get_content_type (SoupRequest  *request)
+{
+	return SOUP_REQUEST_GET_CLASS (request)->get_content_type (request);
+}
diff --git a/libsoup/soup-request.h b/libsoup/soup-request.h
index 512ac05..95da57c 100644
--- a/libsoup/soup-request.h
+++ b/libsoup/soup-request.h
@@ -44,6 +44,9 @@ struct _SoupRequestClass {
 	GInputStream * (*send_finish) (SoupRequest          *request,
 				       GAsyncResult         *result,
 				       GError              **error);
+
+	goffset        (*get_content_length) (SoupRequest   *request);
+	const char *   (*get_content_type)   (SoupRequest   *request);
 };
 
 GType soup_request_get_type (void);
@@ -51,19 +54,22 @@ GType soup_request_get_type (void);
 #define SOUP_REQUEST_URI     "uri"
 #define SOUP_REQUEST_SESSION "session"
 
-GInputStream *soup_request_send        (SoupRequest          *request,
-					GCancellable         *cancellable,
-					GError              **error);
-void          soup_request_send_async  (SoupRequest          *request,
-					GCancellable         *cancellable,
-					GAsyncReadyCallback   callback,
-					gpointer              user_data);
-GInputStream *soup_request_send_finish (SoupRequest          *request,
-					GAsyncResult         *result,
-					GError              **error);
-
-SoupURI      *soup_request_get_uri     (SoupRequest          *request);
-SoupSession  *soup_request_get_session (SoupRequest          *request);
+GInputStream *soup_request_send               (SoupRequest          *request,
+					       GCancellable         *cancellable,
+					       GError              **error);
+void          soup_request_send_async         (SoupRequest          *request,
+					       GCancellable         *cancellable,
+					       GAsyncReadyCallback   callback,
+					       gpointer              user_data);
+GInputStream *soup_request_send_finish        (SoupRequest          *request,
+					       GAsyncResult         *result,
+					       GError              **error);
+
+SoupURI      *soup_request_get_uri            (SoupRequest          *request);
+SoupSession  *soup_request_get_session        (SoupRequest          *request);
+
+goffset       soup_request_get_content_length (SoupRequest          *request);
+const char   *soup_request_get_content_type   (SoupRequest          *request);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]