[libdmapsharing] Change dmap_connection_get_headers so that it no longer takes a bytes argument and returns a SoupMes
- From: W. Michael Petullo <wmpetullo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdmapsharing] Change dmap_connection_get_headers so that it no longer takes a bytes argument and returns a SoupMes
- Date: Sat, 27 Feb 2010 22:48:47 +0000 (UTC)
commit 6b84b6ed7ea8d4ded14363feb46175655e148079
Author: W. Michael Petullo <mike flyn org>
Date: Sat Feb 27 17:07:16 2010 -0500
Change dmap_connection_get_headers so that it no longer takes a bytes
argument and returns a SoupMessageHeaders *. This is to remain compatible
with Rhythmbox.
Signed-off-by: W. Michael Petullo <mike flyn org>
ChangeLog | 6 ++++
config.h.in | 3 --
configure.ac | 2 +-
libdmapsharing/dmap-connection.c | 52 +++++++++++++++++++------------------
libdmapsharing/dmap-connection.h | 5 +--
5 files changed, 36 insertions(+), 32 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ad94ad2..1674f5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+27 February 2010 W. Michael Petullo <mike flyn org>
+
+ * Change dmap_connection_get_headers so that it no longer takes a
+ bytes argument and returns a SoupMessageHeaders *. This is to remain
+ compatible with Rhythmbox.
+
12 December 2009 W. Michael Petullo <mike flyn org>
* Fixed debug statement that caused segfaults of MIPS32 and
diff --git a/config.h.in b/config.h.in
index d06e6a1..4e5b5f2 100644
--- a/config.h.in
+++ b/config.h.in
@@ -82,9 +82,6 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
/* Define to the version of this package. */
#undef PACKAGE_VERSION
diff --git a/configure.ac b/configure.ac
index d99fea6..2852091 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(libdmapsharing, 1.9.0.15)
+AC_INIT(libdmapsharing, 1.9.0.16)
dnl when going to/from release please set the nano (fourth number) right !
dnl releases only do Wall, cvs and prerelease does Werror too
diff --git a/libdmapsharing/dmap-connection.c b/libdmapsharing/dmap-connection.c
index 70fc22f..3f05300 100644
--- a/libdmapsharing/dmap-connection.c
+++ b/libdmapsharing/dmap-connection.c
@@ -1572,16 +1572,15 @@ dmap_connection_do_something (DMAPConnection *connection)
return FALSE;
}
-char *
+SoupMessageHeaders *
dmap_connection_get_headers (DMAPConnection *connection,
- const gchar *uri,
- gint64 bytes)
+ const gchar *uri)
{
DMAPConnectionPrivate *priv = connection->priv;
- GString *headers;
+ SoupMessageHeaders *headers = NULL;
char hash[33] = {0};
char *norb_daap_uri = (char *)uri;
- char *s;
+ char *request_id;
priv->request_id++;
@@ -1594,37 +1593,40 @@ dmap_connection_get_headers (DMAPConnection *connection,
(guchar*)hash,
priv->request_id);
- headers = g_string_new ("Accept: */*\r\n"
- "Cache-Control: no-cache\r\n"
- "User-Agent: " DMAP_USER_AGENT "\r\n"
- "Accept-Language: en-us, en;q=5.0\r\n"
- "Client-DAAP-Access-Index: 2\r\n"
- "Client-DAAP-Version: 3.0\r\n");
- g_string_append_printf (headers,
- "Client-DAAP-Validation: %s\r\n"
- "Client-DAAP-Request-ID: %d\r\n"
- "Connection: close\r\n",
- hash, priv->request_id);
+ headers = soup_message_headers_new (SOUP_MESSAGE_HEADERS_REQUEST);
+
+ soup_message_headers_append (headers, "Accept", "*/*");
+ soup_message_headers_append (headers, "Cache-Control", "no-cache");
+ soup_message_headers_append (headers, "User-Agent", DMAP_USER_AGENT);
+ soup_message_headers_append (headers, "Accept-Language",
+ "en-us, en;q=5.0");
+ soup_message_headers_append (headers, "Client-DAAP-Access-Index",
+ "2");
+ soup_message_headers_append (headers, "Client-DAAP-Version", "3.0");
+ soup_message_headers_append (headers, "Client-DAAP-Validation", hash);
+
+ request_id = g_strdup_printf ("%d", priv->request_id);
+ soup_message_headers_append (headers, "Client-DAAP-Request-ID",
+ request_id);
+ g_free (request_id);
+
+ soup_message_headers_append (headers, "Connection", "close");
if (priv->password_protected) {
char *user_pass;
char *token;
+ char *value;
user_pass = g_strdup_printf ("%s:%s", priv->username, priv->password);
token = g_base64_encode ((guchar *)user_pass, strlen (user_pass));
- g_string_append_printf (headers, "Authentication: Basic %s\r\n", token);
+ value = g_strconcat ("Basic ", token, NULL);
+ soup_message_headers_append (headers, "Authentication", value);
+ g_free (value);
g_free (token);
g_free (user_pass);
}
- if (bytes != 0) {
- g_string_append_printf (headers,"Range: bytes=%"G_GINT64_FORMAT"-\r\n", bytes);
- }
-
- s = headers->str;
- g_string_free (headers, FALSE);
-
- return s;
+ return headers;
}
GSList *
diff --git a/libdmapsharing/dmap-connection.h b/libdmapsharing/dmap-connection.h
index 504cf63..de29001 100644
--- a/libdmapsharing/dmap-connection.h
+++ b/libdmapsharing/dmap-connection.h
@@ -154,9 +154,8 @@ void dmap_connection_disconnect (DMAPConnection *conne
DMAPConnectionCallback callback,
gpointer user_data);
-char * dmap_connection_get_headers (DMAPConnection *connection,
- const char *uri,
- gint64 bytes);
+SoupMessageHeaders *dmap_connection_get_headers (DMAPConnection *connection,
+ const char *uri);
GSList * dmap_connection_get_playlists (DMAPConnection *connection);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]