Rollback "Add REQUIRE_HTTPS flag"
*** Reason for rollback *** Flag doesn't enforce what it says it enforces, due to redirects *** Original change description *** Add REQUIRE_HTTPS flag Note that it's not possible for the library to enforce that the flag is adhered to, since it's possible for applications to inject custom implementations of DataSource (there's no requirement they even extend HttpDataSource for network requesting implementations). It's possible for applications to replace pretty much anything in the library, so there's no other place we could put the flag where we could make this guarantee. Hence this is a best-effort that will work when... *** ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=136583459
This commit is contained in:
parent
aecbbdd36c
commit
aa1002a0d6
@ -20,7 +20,6 @@ import android.os.ConditionVariable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlayerFlags;
|
||||
import com.google.android.exoplayer2.upstream.DataSourceException;
|
||||
import com.google.android.exoplayer2.upstream.DataSpec;
|
||||
import com.google.android.exoplayer2.upstream.HttpDataSource;
|
||||
@ -207,7 +206,7 @@ public class CronetDataSource extends UrlRequest.Callback implements HttpDataSou
|
||||
|
||||
@Override
|
||||
public long open(DataSpec dataSpec) throws HttpDataSourceException {
|
||||
Assertions.checkState(!ExoPlayerFlags.REQUIRE_HTTPS || dataSpec.isHttps());
|
||||
Assertions.checkNotNull(dataSpec);
|
||||
Assertions.checkState(!opened);
|
||||
|
||||
operation.close();
|
||||
|
@ -17,7 +17,6 @@ package com.google.android.exoplayer2.ext.okhttp;
|
||||
|
||||
import android.net.Uri;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlayerFlags;
|
||||
import com.google.android.exoplayer2.upstream.DataSourceException;
|
||||
import com.google.android.exoplayer2.upstream.DataSpec;
|
||||
import com.google.android.exoplayer2.upstream.HttpDataSource;
|
||||
@ -146,8 +145,6 @@ public class OkHttpDataSource implements HttpDataSource {
|
||||
|
||||
@Override
|
||||
public long open(DataSpec dataSpec) throws HttpDataSourceException {
|
||||
Assertions.checkState(!ExoPlayerFlags.REQUIRE_HTTPS || dataSpec.isHttps());
|
||||
|
||||
this.dataSpec = dataSpec;
|
||||
this.bytesRead = 0;
|
||||
this.bytesSkipped = 0;
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer2;
|
||||
|
||||
/**
|
||||
* Global configuration flags. Applications may toggle these flags, but should do so prior to any
|
||||
* other use of the library.
|
||||
*/
|
||||
public final class ExoPlayerFlags {
|
||||
|
||||
/**
|
||||
* If set, indicates to {@link com.google.android.exoplayer2.upstream.HttpDataSource}
|
||||
* implementations that they should reject non-HTTPS requests.
|
||||
*/
|
||||
public static boolean REQUIRE_HTTPS = false;
|
||||
|
||||
private ExoPlayerFlags() {}
|
||||
|
||||
}
|
@ -167,13 +167,6 @@ public final class DataSpec {
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the instance defines a HTTPS request.
|
||||
*/
|
||||
public boolean isHttps() {
|
||||
return uri != null && "https".equalsIgnoreCase(uri.getScheme());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DataSpec[" + uri + ", " + Arrays.toString(postBody) + ", " + absoluteStreamPosition
|
||||
|
@ -19,7 +19,6 @@ import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlayerFlags;
|
||||
import com.google.android.exoplayer2.util.Assertions;
|
||||
import com.google.android.exoplayer2.util.Predicate;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
@ -187,8 +186,6 @@ public class DefaultHttpDataSource implements HttpDataSource {
|
||||
|
||||
@Override
|
||||
public long open(DataSpec dataSpec) throws HttpDataSourceException {
|
||||
Assertions.checkState(!ExoPlayerFlags.REQUIRE_HTTPS || dataSpec.isHttps());
|
||||
|
||||
this.dataSpec = dataSpec;
|
||||
this.bytesRead = 0;
|
||||
this.bytesSkipped = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user