[PATCH] Using absolute URLs in the CDDB requests
Alejandro Luque <[email protected]>
| Newsgroups | gmane.comp.multimedia.xmms.devel |
|---|---|
| Message-ID | <Pine.LNX.4.33.0406021525390.25266-100000@btp5x36.phy.uni-bayreuth.de> |
Hi everybody!
Recently I experienced some difficulties in connecting xmms (cdaudio) to any of
the freedb.org mirrors of CDDB servers.
Apparently, the problem is caused by the freedb.org server not
accepting relative URLs in the GET request. The HTTP 1.1 standard says
that all servers MUST accept absolute URLs and recommends that in some
future all clients send only absolute URLs. Therefore i though it
would be nice to change xmms to use only absolute URLs in the
requests, so conforming to the HTTP/1.1 directives and solving my
problem with freedb.org.
To do this, i submit a rather trivial patch in which, however, i did not
upgrade the HTTP version to 1.1 because i'm afraid some CDDB servers
may still have HTTP 1.0. I tested the patch and it does work with
freedb, but i was not able to test it with any other CDDB server. Can
somebody do this?
Best regards,
Alejandro Luque
----
Alejandro Luque
Universitaet Bayreuth
Theoretische Physik IV
95440 Bayreuth (Germany)
Tel. +49-(0)921/55-3328
e-mail: <alejandro DOT luque AT uni-bayreuth DOT de>
#################### Beginning of patch #############################
diff -ru xmms-1.2.10/Input/cdaudio/cddb.c xmms-1.2.10-patched/Input/cdaudio/cddb.c
--- xmms-1.2.10/Input/cdaudio/cddb.c Mon Nov 10 22:20:34 2003
+++ xmms-1.2.10-patched/Input/cdaudio/cddb.c Tue Jun 1 11:12:50 2004
@@ -185,7 +185,8 @@
cddb_log("Sending query-command. Disc ID: %08x", cdda_cddb_compute_discid(info));
getstr = g_strdup_printf(
- "GET /~cddb/cddb.cgi?cmd=cddb+query+%08x+%d+%s+%d%s&proto=%d HTTP/1.0\r\n\r\n",
+ "GET http://%s/~cddb/cddb.cgi?cmd=cddb+query+%08x+%d+%s+%d%s&proto=%d HTTP/1.0\r\n\r\n",
+ server,
cdda_cddb_compute_discid(info), info->last_track - info->first_track + 1,
offsets, (info->leadout.minute * 60 + info->leadout.second),
cddb_generate_hello_string(), cdda_cfg.cddb_protocol_level);
@@ -238,7 +239,8 @@
return 0;
str = g_strdup_printf(
- "GET /~cddb/cddb.cgi?cmd=stat%s&proto=1 HTTP/1.0\r\n\r\n",
+ "GET http://%s/~cddb/cddb.cgi?cmd=stat%s&proto=1 HTTP/1.0\r\n\r\n",
+ server,
cddb_generate_hello_string());
write(sock, str, strlen(str));
@@ -288,7 +290,8 @@
cddb_info->discid, cddb_info->category);
readstr = g_strdup_printf(
- "GET /~cddb/cddb.cgi?cmd=cddb+read+%s+%08x%s&proto=%d HTTP/1.0\r\n\r\n",
+ "GET http://%s/~cddb/cddb.cgi?cmd=cddb+read+%s+%08x%s&proto=%d HTTP/1.0\r\n\r\n",
+ server,
cddb_info->category, cddb_info->discid, cddb_generate_hello_string(),
cdda_cfg.cddb_protocol_level);
@@ -418,7 +421,8 @@
cddb_log("Sending sites-command");
getstr = g_strdup_printf(
- "GET /~cddb/cddb.cgi?cmd=sites%s&proto=%d HTTP/1.0\r\n\r\n",
+ "GET http://%s/~cddb/cddb.cgi?cmd=sites%s&proto=%d HTTP/1.0\r\n\r\n",
+ server,
cddb_generate_hello_string(), protocol_level);
write(sock, getstr, strlen(getstr));
#################### End of patch #############################