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]; /* LBe Fix bug one! */ 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]; /* LBe Fix bug one! */ 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 the
/* Now only the path is left. */ if(path) ret = mpg123_set_substring(path, url->p, pos, url->fill-1-pos);
thru
/* 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
So, all would be fine if the location URL would be complete (http://46.165.232.24/) ... well, one has to tolerate things. The fix is easy enough.
I'll skip the official announcement of 1.15.0 and release 1.15.1 soon.
I went a partially different route: The split_url() function is supposed to get an URL string as input, not a HTTP line. Cutting the line end before the call now. I still added the check for empty path to GET / in that case.
Please test http://mpg123.org/snapshot , so that it can become release 1.15.1 soon.
i tested it and it runs fine now. thank you.