Bug#700721: mpg123 is failing to split the url from the HTTP 302 location header
ldr-alpha at gmx.de
ldr-alpha at gmx.de
Sat Feb 16 16:36:11 UTC 2013
Package: mpg123
Version: All
When i starts play my favorit Radio Station "http://listen.trancebase.fm/tunein-mp3-pls"
the mpg123 gets a HTTP 404 Not Found:
$ mpg123 -vvvv http://listen.trancebase.fm/tunein-mp3-pls
...
HTTP in: ICY 404 Resource Not Found
HTTP request failed: 404 Resource Not Found
[mpg123.c:566] error: Access to http resource http://listen.trancebase.fm/tunein-mp3-pls failed.
in the verbose mode i saw the problem:
...
HTTP in: HTTP/1.1 302 Found
HTTP in: Date: Sat, 16 Feb 2013 14:20:20 GMT
HTTP in: Server: Apache/2.2.16 (Debian)
HTTP in: X-Powered-By: PHP/5.3.21-1~dotdeb.0
HTTP in: Expires: Sat, 16 Feb 2013 14:20:20 GMT
HTTP in: Last-Modified: Sat, 16 Feb 2013 14:20:20 GMT
HTTP in: Cache-Control: public, max-age=1361024420
HTTP in: location: http://46.165.232.24
HTTP in: Vary: Accept-Encoding
HTTP in: Content-Length: 0
HTTP in: Connection: close
HTTP in: Content-Type: text/html
HTTP in:
Note: Attempting new-style connection to 46.165.232.24
HTTP request:
GET HTTP/1.0
User-Agent: mpg123/1.12.1
Host: 46.165.232.24
:80
Accept: audio/mpeg, audio/x-mpeg, audio/mp3, audio/x-mp3, audio/mpeg3, audio/x-mpeg3, audio/mpg, audio/x-mpg, audio/x-mpegaudio, audio/mpegurl, audio/mpeg-url, audio/x-mpegurl, audio/x-scpls, audio/scpls, application/pls, */*
Icy-MetaData: 1
...
The location header from the HTTP/1.1 302 is wrong splited.
The ending "\r" and/or "\n" ist not dropped but also added to the Hostname.
So is the port in the Host Header moves to the next line :-(
Also is the path not set to "/" with the result thats the get request ist invalid.
"GET HTTP/1.0" sould be "GET / HTTP/1.0"
I get the sources and detect the problem in the function "split_url(...)" from the file "src/resolver.c"
The Funktion needs a path in the URL but do not get it from the header.
to fix the "\r","\n" problem replace the "if "Line
for(pos2=pos; pos2< url->fill-1; ++pos2)
{
char a = url->p[pos2];
if( a == ':' || a == '/' ) break;
}
/* At pos2 there is now either a delimiter or the end. */
if( a == ':' || a == '/' ) break;
thru
for(pos2=pos; pos2< url->fill-1; ++pos2)
{
char a = url->p[pos2];
if( a == ':' || a == '/' || a == '\r' || a == '\n') break;
}
/* At pos2 there is now either a delimiter or the end. */
for the second problem of the missing path replace
/* Now only the path is left. */
if(path) ret = mpg123_set_substring(path, url->p, pos, url->fill-1-pos);
true
/* Now only the path is left. */
if (path)
{
if( url->p[pos] == '\r' || url->p[pos] == '\n')
{
ret = mpg123_set_substring(path, "/", 0, 1);
}
else
{
ret = mpg123_set_substring(path, url->p, pos, url->fill-1-pos);
}
}
Kind regards from Germany
Lars Bendel
More information about the pkg-multimedia-maintainers
mailing list