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

Commit 9073725c authored by Andreas Huber's avatar Andreas Huber
Browse files

More HLS fixes

properly expand URLs where the "new" URL is an absolute path.
properly include any extra headers even when fetching the key files.

Change-Id: I7cd8879015ea8e3d3e2334f4e7e16b8c1a5d48e9
parent 7dde1c8c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -785,7 +785,10 @@ status_t LiveSession::decryptBuffer(
            keySource->setUID(mUID);
        }

        status_t err = keySource->connect(keyURI.c_str());
        status_t err =
            keySource->connect(
                    keyURI.c_str(),
                    mExtraHeaders.isEmpty() ? NULL : &mExtraHeaders);

        if (err == OK) {
            size_t offset = 0;
+26 −9
Original line number Diff line number Diff line
@@ -106,6 +106,22 @@ static bool MakeURL(const char *baseURL, const char *url, AString *out) {
        return true;
    }

    if (url[0] == '/') {
        // URL is an absolute path.

        char *protocolEnd = strstr(baseURL, "//") + 2;
        char *pathStart = strchr(protocolEnd, '/');

        if (pathStart != NULL) {
            out->setTo(baseURL, pathStart - baseURL);
        } else {
            out->setTo(baseURL);
        }

        out->append(url);
    } else {
        // URL is a relative path

        size_t n = strlen(baseURL);
        if (baseURL[n - 1] == '/') {
            out->setTo(baseURL);
@@ -122,6 +138,7 @@ static bool MakeURL(const char *baseURL, const char *url, AString *out) {
            out->append("/");
            out->append(url);
        }
    }

    LOGV("base:'%s', url:'%s' => '%s'", baseURL, url, out->c_str());