Commit 1aa76b5f by aquilescanta Committed by bachinger

Rename error code IO_BAD_HTTP_REQUEST to IO_INVALID_HTTP_CONTENT_TYPE

In order to avoid confusion with HTTP 400 Bad request.

PiperOrigin-RevId: 387145057
parent 0df62a4f
...@@ -52,7 +52,7 @@ public class PlaybackException extends Exception implements Bundleable { ...@@ -52,7 +52,7 @@ public class PlaybackException extends Exception implements Bundleable {
ERROR_CODE_IO_NETWORK_CONNECTION_FAILED, ERROR_CODE_IO_NETWORK_CONNECTION_FAILED,
ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT, ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT,
ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED, ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED,
ERROR_CODE_IO_BAD_HTTP_REQUEST, ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE,
ERROR_CODE_IO_BAD_HTTP_STATUS, ERROR_CODE_IO_BAD_HTTP_STATUS,
ERROR_CODE_IO_DNS_FAILED, ERROR_CODE_IO_DNS_FAILED,
ERROR_CODE_IO_FILE_NOT_FOUND, ERROR_CODE_IO_FILE_NOT_FOUND,
...@@ -115,8 +115,13 @@ public class PlaybackException extends Exception implements Bundleable { ...@@ -115,8 +115,13 @@ public class PlaybackException extends Exception implements Bundleable {
public static final int ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT = 2003; public static final int ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT = 2003;
/** Caused by an existing connection being unexpectedly closed. */ /** Caused by an existing connection being unexpectedly closed. */
public static final int ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED = 2004; public static final int ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED = 2004;
/** Caused by creating a malformed HTTP request. */ /**
public static final int ERROR_CODE_IO_BAD_HTTP_REQUEST = 2005; * Caused by a server returning a resource with an invalid "Content-Type" HTTP header value.
*
* <p>For example, this can happen when the player is expecting a piece of media, but the server
* returns a paywall HTML page, with content type "text/html".
*/
public static final int ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE = 2005;
/** Caused by an HTTP server returning an unexpected HTTP response status code. */ /** Caused by an HTTP server returning an unexpected HTTP response status code. */
public static final int ERROR_CODE_IO_BAD_HTTP_STATUS = 2006; public static final int ERROR_CODE_IO_BAD_HTTP_STATUS = 2006;
/** Caused by the player failing to resolve a hostname. */ /** Caused by the player failing to resolve a hostname. */
...@@ -237,8 +242,8 @@ public class PlaybackException extends Exception implements Bundleable { ...@@ -237,8 +242,8 @@ public class PlaybackException extends Exception implements Bundleable {
return "ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT"; return "ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT";
case ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED: case ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED:
return "ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED"; return "ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED";
case ERROR_CODE_IO_BAD_HTTP_REQUEST: case ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE:
return "ERROR_CODE_IO_BAD_HTTP_REQUEST"; return "ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE";
case ERROR_CODE_IO_BAD_HTTP_STATUS: case ERROR_CODE_IO_BAD_HTTP_STATUS:
return "ERROR_CODE_IO_BAD_HTTP_STATUS"; return "ERROR_CODE_IO_BAD_HTTP_STATUS";
case ERROR_CODE_IO_DNS_FAILED: case ERROR_CODE_IO_DNS_FAILED:
......
...@@ -362,7 +362,7 @@ public interface HttpDataSource extends DataSource { ...@@ -362,7 +362,7 @@ public interface HttpDataSource extends DataSource {
super( super(
"Invalid content type: " + contentType, "Invalid content type: " + contentType,
dataSpec, dataSpec,
PlaybackException.ERROR_CODE_IO_BAD_HTTP_REQUEST, PlaybackException.ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE,
TYPE_OPEN); TYPE_OPEN);
this.contentType = contentType; this.contentType = contentType;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment