Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab2116c3 authored by Andreas Huber's avatar Andreas Huber
Browse files

Support other kinds of HTTP redirect in NuHTTPDataSource

Change-Id: I3268a94cfb48cee9caa8914804d7907ff91d8a8e
related-to-bug: 3037686
parent 6d8fae72
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -96,6 +96,11 @@ status_t NuHTTPDataSource::connect(
    return connect(host, port, path, headers, offset);
    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(
status_t NuHTTPDataSource::connect(
        const char *host, unsigned port, const char *path,
        const char *host, unsigned port, const char *path,
        const String8 &headers,
        const String8 &headers,
@@ -161,7 +166,7 @@ status_t NuHTTPDataSource::connect(
            return err;
            return err;
        }
        }


        if (httpStatus == 302) {
        if (IsRedirectStatusCode(httpStatus)) {
            string value;
            string value;
            CHECK(mHTTP.find_header_value("Location", &value));
            CHECK(mHTTP.find_header_value("Location", &value));