From 7539a0594204c3436571bacabe50a14c78dedf5f Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Mon, 27 Sep 2010 08:17:40 -0700 Subject: Support other kinds of HTTP redirect in NuHTTPDataSource Change-Id: I3268a94cfb48cee9caa8914804d7907ff91d8a8e related-to-bug: 3037686 --- media/libstagefright/NuHTTPDataSource.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'media') diff --git a/media/libstagefright/NuHTTPDataSource.cpp b/media/libstagefright/NuHTTPDataSource.cpp index ab9285d..fcbfdac 100644 --- a/media/libstagefright/NuHTTPDataSource.cpp +++ b/media/libstagefright/NuHTTPDataSource.cpp @@ -96,6 +96,11 @@ status_t NuHTTPDataSource::connect( return connect(host, port, path, headers, offset); } +static bool IsRedirectStatusCode(int httpStatus) { + return httpStatus == 301 || httpStatus == 302 + || httpStatus == 303 || httpStatus == 307; +} + status_t NuHTTPDataSource::connect( const char *host, unsigned port, const char *path, const String8 &headers, @@ -161,7 +166,7 @@ status_t NuHTTPDataSource::connect( return err; } - if (httpStatus == 302) { + if (IsRedirectStatusCode(httpStatus)) { string value; CHECK(mHTTP.find_header_value("Location", &value)); -- cgit v1.1