You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all,
I fixed a redirect problem on library. I have a stream url which redirects
other urls, and this library "Moved Permanently ..." error on logs. I simply
add below codes you may need same bug.
Find openConnection method and update below /**New*/ rows.
if (conn instanceof HttpURLConnection) {
HttpURLConnection httpConn = (HttpURLConnection) conn;
/**New*/ HttpURLConnection.setFollowRedirects(true);
try {
// pre-KitKat returns -1:
if (httpConn.getResponseCode() == -1) {
if (!responseCodeCheckEnabled) {
Log.w( LOG, "No response code, but ignoring - for url " + url );
close = false;
break;
}
else {
Log.w( LOG, "No response code for url " + url );
}
/**New*/ } else if (httpConn.getResponseCode() ==
HttpURLConnection.HTTP_MOVED_TEMP || httpConn.getResponseCode() ==
HttpURLConnection.HTTP_MOVED_PERM) {
/**New*/ url = conn.getHeaderField("Location");
/**New*/ // open the new connnection again
/**New*/ conn = (HttpURLConnection) new URL(url).openConnection();
/**New*/ throw new Exception();
} else {
// standard HTTP response / IcyURLConnection response
close = false;
break;
}
}
catch (Exception e) {
// KitKat throws exception:
// java.net.ProtocolException: Unexpected status line: ICY 200 OK
Log.w( LOG, "Invalid response code for url " + url + " - " + e );
}
}
Original issue reported on code.google.com by [email protected] on 31 Aug 2014 at 12:41
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 31 Aug 2014 at 12:41The text was updated successfully, but these errors were encountered: