Loading media/java/android/media/MediaHTTPConnection.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.media; import android.net.NetworkUtils; import android.net.NetworkUtils; import android.os.IBinder; import android.os.IBinder; import android.os.StrictMode; import android.os.StrictMode; import android.os.SystemProperties; import android.util.Log; import android.util.Log; import java.io.BufferedInputStream; import java.io.BufferedInputStream; Loading @@ -34,6 +35,7 @@ import java.net.NoRouteToHostException; import java.net.ProtocolException; import java.net.ProtocolException; import java.net.UnknownServiceException; import java.net.UnknownServiceException; import java.util.HashMap; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map; import java.net.InetSocketAddress; import java.net.InetSocketAddress; Loading @@ -59,6 +61,8 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { private HttpURLConnection mConnection = null; private HttpURLConnection mConnection = null; private long mTotalSize = -1; private long mTotalSize = -1; private InputStream mInputStream = null; private InputStream mInputStream = null; private List<String> mCookies = null; private boolean mIsCookieUpdated = false; private boolean mAllowCrossDomainRedirect = true; private boolean mAllowCrossDomainRedirect = true; private boolean mAllowCrossProtocolRedirect = true; private boolean mAllowCrossProtocolRedirect = true; Loading Loading @@ -117,6 +121,8 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { mProxyPort = Integer.parseInt(val.substring(colonPos + 1)); mProxyPort = Integer.parseInt(val.substring(colonPos + 1)); Log.d(TAG, "sta-proxy-ip " + mProxyIP + " port " + mProxyPort); Log.d(TAG, "sta-proxy-ip " + mProxyIP + " port " + mProxyPort); } } } else if ("Cookie".equalsIgnoreCase(key) && mIsCookieUpdated) { Log.d(TAG, "filterOutInternalHeaders: Cookie"); } else { } else { return false; return false; } } Loading Loading @@ -222,6 +228,14 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { } } } } if (mIsCookieUpdated) { if (VERBOSE) Log.d(TAG, "add Cookie in the request"); for (String cookie : mCookies) { mConnection.addRequestProperty("Cookie", cookie.split(";", 2)[0]); } } if (offset > 0) { if (offset > 0) { mConnection.setRequestProperty( mConnection.setRequestProperty( "Range", "bytes=" + offset + "-"); "Range", "bytes=" + offset + "-"); Loading Loading @@ -308,6 +322,16 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { throw new IOException(); throw new IOException(); } else { } else { mTotalSize = mConnection.getContentLength(); mTotalSize = mConnection.getContentLength(); if (mConnection.getHeaderFields().containsKey("Set-Cookie")) { mIsCookieUpdated = SystemProperties.getBoolean( "persist.media.cookie.cust", false); mCookies = mConnection.getHeaderFields().get("Set-Cookie"); if (VERBOSE) { for (String cookie : mCookies) { Log.d(TAG, "get Cookie" + cookie); } } } } } if (offset > 0 && response != HttpURLConnection.HTTP_PARTIAL) { if (offset > 0 && response != HttpURLConnection.HTTP_PARTIAL) { Loading Loading
media/java/android/media/MediaHTTPConnection.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.media; import android.net.NetworkUtils; import android.net.NetworkUtils; import android.os.IBinder; import android.os.IBinder; import android.os.StrictMode; import android.os.StrictMode; import android.os.SystemProperties; import android.util.Log; import android.util.Log; import java.io.BufferedInputStream; import java.io.BufferedInputStream; Loading @@ -34,6 +35,7 @@ import java.net.NoRouteToHostException; import java.net.ProtocolException; import java.net.ProtocolException; import java.net.UnknownServiceException; import java.net.UnknownServiceException; import java.util.HashMap; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map; import java.net.InetSocketAddress; import java.net.InetSocketAddress; Loading @@ -59,6 +61,8 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { private HttpURLConnection mConnection = null; private HttpURLConnection mConnection = null; private long mTotalSize = -1; private long mTotalSize = -1; private InputStream mInputStream = null; private InputStream mInputStream = null; private List<String> mCookies = null; private boolean mIsCookieUpdated = false; private boolean mAllowCrossDomainRedirect = true; private boolean mAllowCrossDomainRedirect = true; private boolean mAllowCrossProtocolRedirect = true; private boolean mAllowCrossProtocolRedirect = true; Loading Loading @@ -117,6 +121,8 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { mProxyPort = Integer.parseInt(val.substring(colonPos + 1)); mProxyPort = Integer.parseInt(val.substring(colonPos + 1)); Log.d(TAG, "sta-proxy-ip " + mProxyIP + " port " + mProxyPort); Log.d(TAG, "sta-proxy-ip " + mProxyIP + " port " + mProxyPort); } } } else if ("Cookie".equalsIgnoreCase(key) && mIsCookieUpdated) { Log.d(TAG, "filterOutInternalHeaders: Cookie"); } else { } else { return false; return false; } } Loading Loading @@ -222,6 +228,14 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { } } } } if (mIsCookieUpdated) { if (VERBOSE) Log.d(TAG, "add Cookie in the request"); for (String cookie : mCookies) { mConnection.addRequestProperty("Cookie", cookie.split(";", 2)[0]); } } if (offset > 0) { if (offset > 0) { mConnection.setRequestProperty( mConnection.setRequestProperty( "Range", "bytes=" + offset + "-"); "Range", "bytes=" + offset + "-"); Loading Loading @@ -308,6 +322,16 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub { throw new IOException(); throw new IOException(); } else { } else { mTotalSize = mConnection.getContentLength(); mTotalSize = mConnection.getContentLength(); if (mConnection.getHeaderFields().containsKey("Set-Cookie")) { mIsCookieUpdated = SystemProperties.getBoolean( "persist.media.cookie.cust", false); mCookies = mConnection.getHeaderFields().get("Set-Cookie"); if (VERBOSE) { for (String cookie : mCookies) { Log.d(TAG, "get Cookie" + cookie); } } } } } if (offset > 0 && response != HttpURLConnection.HTTP_PARTIAL) { if (offset > 0 && response != HttpURLConnection.HTTP_PARTIAL) { Loading