From: Jaroslav Kysela Date: Thu, 19 Nov 2015 14:35:40 +0000 (+0100) Subject: download: pass full url to the process callback X-Git-Tag: v4.2.1~1513 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=04ea0e8da4832a4e5ba8b8ae978df203960ab5ec;p=thirdparty%2Ftvheadend.git download: pass full url to the process callback --- diff --git a/src/download.c b/src/download.c index b849fff11..185714d80 100644 --- a/src/download.c +++ b/src/download.c @@ -96,10 +96,8 @@ static int download_fetch_complete(http_client_t *hc) { download_t *dn = hc->hc_aux; - char *last_url = NULL; - char host_url[512]; - char *s, *p; - url_t u, u2; + const char *last_url = NULL; + url_t u; switch (hc->hc_code) { case HTTP_STATUS_MOVED: @@ -115,25 +113,6 @@ download_fetch_complete(http_client_t *hc) if (last_url) last_url++; } - if ((p = http_arg_get(&hc->hc_args, "Host")) != NULL) { - snprintf(host_url, sizeof(host_url), "%s://%s", - hc->hc_ssl ? "https" : "http", p); - } else if (dn->url) { - s = strdupa(dn->url); - if ((p = strchr(s, '/')) != NULL) { - p++; - if (*p == '/') - p++; - if ((p = strchr(p, '/')) != NULL) - *p = '\0'; - } - urlinit(&u2); - if (!urlparse(s, &u2)) - snprintf(host_url, sizeof(host_url), "%s", s); - urlreset(&u2); - } else { - host_url[0] = '\0'; - } pthread_mutex_lock(&global_lock); @@ -141,7 +120,7 @@ download_fetch_complete(http_client_t *hc) goto out; if (hc->hc_code == HTTP_STATUS_OK && hc->hc_result == 0 && hc->hc_data_size > 0) - dn->process(dn->aux, last_url, host_url, hc->hc_data, hc->hc_data_size); + dn->process(dn->aux, last_url, hc->hc_url, hc->hc_data, hc->hc_data_size); else tvherror(dn->log, "unable to fetch data from url [%d-%d/%zd]", hc->hc_code, hc->hc_result, hc->hc_data_size);