static int http_open_cnx_internal(URLContext *h, AVDictionary **options)

{

    const char *path, *proxy_path, *lower_proto = "tcp", *local_path;

    char hostname[1024], hoststr[1024], proto[10];

    char auth[1024], proxyauth[1024] = "";

    char path1[MAX_URL_SIZE];

    char buf[1024], urlbuf[MAX_URL_SIZE];

    int port, use_proxy, err, location_changed = 0;

    HTTPContext *s = h->priv_data;



    av_url_split(proto, sizeof(proto), auth, sizeof(auth),

                 hostname, sizeof(hostname), &port,

                 path1, sizeof(path1), s->location);

    ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);



    proxy_path = getenv("http_proxy");

    use_proxy  = !ff_http_match_no_proxy(getenv("no_proxy"), hostname) &&

                 proxy_path != NULL && av_strstart(proxy_path, "http://", NULL);



    if (!strcmp(proto, "https")) {

        lower_proto = "tls";

        use_proxy   = 0;

        if (port < 0)

            port = 443;

    }

    if (port < 0)

        port = 80;



    if (path1[0] == '\0')

        path = "/";

    else

        path = path1;

    local_path = path;

    if (use_proxy) {

        /* Reassemble the request URL without auth string - we don't

         * want to leak the auth to the proxy. */

        ff_url_join(urlbuf, sizeof(urlbuf), proto, NULL, hostname, port, "%s",

                    path1);

        path = urlbuf;

        av_url_split(NULL, 0, proxyauth, sizeof(proxyauth),

                     hostname, sizeof(hostname), &port, NULL, 0, proxy_path);

    }



    ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);



    if (!s->hd) {

        err = ffurl_open(&s->hd, buf, AVIO_FLAG_READ_WRITE,

                         &h->interrupt_callback, options);

        if (err < 0)

            return err;

    }



    err = http_connect(h, path, local_path, hoststr,

                       auth, proxyauth, &location_changed);

    if (err < 0)

        return err;



    return location_changed;

}

static int http_open_cnx_internal(URLContext *h, AVDictionary **options)

{

    const char *path, *proxy_path, *lower_proto = "tcp", *local_path;

    char hostname[1024], hoststr[1024], proto[10];

    char auth[1024], proxyauth[1024] = "";

    char path1[MAX_URL_SIZE];

    char buf[1024], urlbuf[MAX_URL_SIZE];

    int port, use_proxy, err, location_changed = 0;

    HTTPContext *s = h->priv_data;



    av_url_split(proto, sizeof(proto), auth, sizeof(auth),

                 hostname, sizeof(hostname), &port,

                 path1, sizeof(path1), s->location);

    ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);



    proxy_path = getenv("http_proxy");

    use_proxy  = !ff_http_match_no_proxy(getenv("no_proxy"), hostname) &&

                 proxy_path != NULL && av_strstart(proxy_path, "http:



    if (!strcmp(proto, "https")) {

        lower_proto = "tls";

        use_proxy   = 0;

        if (port < 0)

            port = 443;

    }

    if (port < 0)

        port = 80;



    if (path1[0] == '\0')

        path = "/";

    else

        path = path1;

    local_path = path;

    if (use_proxy) {

        



        ff_url_join(urlbuf, sizeof(urlbuf), proto, NULL, hostname, port, "%s",

                    path1);

        path = urlbuf;

        av_url_split(NULL, 0, proxyauth, sizeof(proxyauth),

                     hostname, sizeof(hostname), &port, NULL, 0, proxy_path);

    }



    ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);



    if (!s->hd) {

        err = ffurl_open(&s->hd, buf, AVIO_FLAG_READ_WRITE,

                         &h->interrupt_callback, options);

        if (err < 0)

            return err;

    }



    err = http_connect(h, path, local_path, hoststr,

                       auth, proxyauth, &location_changed);

    if (err < 0)

        return err;



    return location_changed;

}

static int FUNC_0(URLContext *VAR_0, AVDictionary **VAR_1)

{

    const char *VAR_2, *VAR_3, *VAR_4 = "tcp", *VAR_5;

    char VAR_6[1024], VAR_7[1024], VAR_8[10];

    char VAR_9[1024], VAR_10[1024] = "";

    char VAR_11[MAX_URL_SIZE];

    char VAR_12[1024], urlbuf[MAX_URL_SIZE];

    int VAR_13, VAR_14, VAR_15, VAR_16 = 0;

    HTTPContext *s = VAR_0->priv_data;



    av_url_split(VAR_8, sizeof(VAR_8), VAR_9, sizeof(VAR_9),

                 VAR_6, sizeof(VAR_6), &VAR_13,

                 VAR_11, sizeof(VAR_11), s->location);

    ff_url_join(VAR_7, sizeof(VAR_7), NULL, NULL, VAR_6, VAR_13, NULL);



    VAR_3 = getenv("http_proxy");

    VAR_14  = !ff_http_match_no_proxy(getenv("no_proxy"), VAR_6) &&

                 VAR_3 != NULL && av_strstart(VAR_3, "http:



    if (!strcmp(VAR_8, "https")) {

        VAR_4 = "tls";

        VAR_14   = 0;

        if (VAR_13 < 0)

            VAR_13 = 443;

    }

    if (VAR_13 < 0)

        VAR_13 = 80;



    if (VAR_11[0] == '\0')

        VAR_2 = "/";

    else

        VAR_2 = VAR_11;

    VAR_5 = VAR_2;

    if (VAR_14) {

        



        ff_url_join(urlbuf, sizeof(urlbuf), VAR_8, NULL, VAR_6, VAR_13, "%s",

                    VAR_11);

        VAR_2 = urlbuf;

        av_url_split(NULL, 0, VAR_10, sizeof(VAR_10),

                     VAR_6, sizeof(VAR_6), &VAR_13, NULL, 0, VAR_3);

    }



    ff_url_join(VAR_12, sizeof(VAR_12), VAR_4, NULL, VAR_6, VAR_13, NULL);



    if (!s->hd) {

        VAR_15 = ffurl_open(&s->hd, VAR_12, AVIO_FLAG_READ_WRITE,

                         &VAR_0->interrupt_callback, VAR_1);

        if (VAR_15 < 0)

            return VAR_15;

    }



    VAR_15 = http_connect(VAR_0, VAR_2, VAR_5, VAR_7,

                       VAR_9, VAR_10, &VAR_16);

    if (VAR_15 < 0)

        return VAR_15;



    return VAR_16;

}

static int FUNC_0(URLContext *VAR_0, AVDictionary **VAR_1)
{ const char *VAR_2, *VAR_3, *VAR_4 = "tcp", *VAR_5; char VAR_6[1024], VAR_7[1024], VAR_8[10]; char VAR_9[1024], VAR_10[1024] = ""; char VAR_11[MAX_URL_SIZE]; char VAR_12[1024], urlbuf[MAX_URL_SIZE]; int VAR_13, VAR_14, VAR_15, VAR_16 = 0; HTTPContext *s = VAR_0->priv_data; av_url_split(VAR_8, sizeof(VAR_8), VAR_9, sizeof(VAR_9),
VAR_6, sizeof(VAR_6), &VAR_13,
VAR_11, sizeof(VAR_11), s->location); ff_url_join(VAR_7, sizeof(VAR_7), NULL, NULL, VAR_6, VAR_13, NULL); VAR_3 = getenv("http_proxy"); VAR_14  = !ff_http_match_no_proxy(getenv("no_proxy"), VAR_6) &&
VAR_3 != NULL && av_strstart(VAR_3, "http:
if (!strcmp(VAR_8, "https")) { VAR_4 = "tls"; VAR_14   = 0; if (VAR_13 < 0)
VAR_13 = 443; } if (VAR_13 < 0)
VAR_13 = 80; if (VAR_11[0] == '\0')
VAR_2 = "/"; else
VAR_2 = VAR_11; VAR_5 = VAR_2; if (VAR_14) { ff_url_join(urlbuf, sizeof(urlbuf), VAR_8, NULL, VAR_6, VAR_13, "%s",
VAR_11); VAR_2 = urlbuf; av_url_split(NULL, 0, VAR_10, sizeof(VAR_10),
VAR_6, sizeof(VAR_6), &VAR_13, NULL, 0, VAR_3); } ff_url_join(VAR_12, sizeof(VAR_12), VAR_4, NULL, VAR_6, VAR_13, NULL); if (!s->hd) { VAR_15 = ffurl_open(&s->hd, VAR_12, AVIO_FLAG_READ_WRITE,
&VAR_0->interrupt_callback, VAR_1); if (VAR_15 < 0)
return VAR_15; } VAR_15 = http_connect(VAR_0, VAR_2, VAR_5, VAR_7,
VAR_9, VAR_10, &VAR_16); if (VAR_15 < 0)
return VAR_15; return VAR_16; }