summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/NuHTTPDataSource.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-09-27 08:17:40 -0700
committerAndreas Huber <andih@google.com>2010-09-27 09:16:44 -0700
commitab2116c3516b2d731e4e34f6fcb5cdac503f2049 (patch)
tree8b3fd576e41a7a848a7b9e34c0e8fb1ccd60c9cd /media/libstagefright/NuHTTPDataSource.cpp
parent6d8fae722cfb2833dd542b2a5e613582a9096fc6 (diff)
downloadframeworks_base-ab2116c3516b2d731e4e34f6fcb5cdac503f2049.zip
frameworks_base-ab2116c3516b2d731e4e34f6fcb5cdac503f2049.tar.gz
frameworks_base-ab2116c3516b2d731e4e34f6fcb5cdac503f2049.tar.bz2
Support other kinds of HTTP redirect in NuHTTPDataSource
Change-Id: I3268a94cfb48cee9caa8914804d7907ff91d8a8e related-to-bug: 3037686
Diffstat (limited to 'media/libstagefright/NuHTTPDataSource.cpp')
-rw-r--r--media/libstagefright/NuHTTPDataSource.cpp7
1 files changed, 6 insertions, 1 deletions
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));