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

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

Better handling of forming absolute https URLs, runtime error on https:// access.

Change-Id: I7f6275520b0bd070e645024dd151a8541b8787b2
parent b057c3db
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -179,9 +179,9 @@ status_t LiveSession::fetchFile(const char *url, sp<ABuffer> *out) {

    if (!strncasecmp(url, "file://", 7)) {
        source = new FileSource(url + 7);
    } else if (strncasecmp(url, "http://", 7)) {
        return ERROR_UNSUPPORTED;
    } else {
        CHECK(!strncasecmp(url, "http://", 7));

        status_t err = mHTTPDataSource->connect(url);

        if (err != OK) {
+2 −1
Original line number Diff line number Diff line
@@ -84,12 +84,13 @@ static bool MakeURL(const char *baseURL, const char *url, AString *out) {
    out->clear();

    if (strncasecmp("http://", baseURL, 7)
            && strncasecmp("https://", baseURL, 8)
            && strncasecmp("file://", baseURL, 7)) {
        // Base URL must be absolute
        return false;
    }

    if (!strncasecmp("http://", url, 7)) {
    if (!strncasecmp("http://", url, 7) || !strncasecmp("https://", url, 8)) {
        // "url" is already an absolute URL, ignore base URL.
        out->setTo(url);