[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 16/29] urlinstTransfer and support functions do not operate on iurlinfo anymore.



---
 loader/urlinstall.c |   16 ++++++++--------
 loader/urls.c       |   18 +++++++++---------
 loader/urls.h       |    2 +-
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/loader/urlinstall.c b/loader/urlinstall.c
index 5e6e559..5920329 100644
--- a/loader/urlinstall.c
+++ b/loader/urlinstall.c
@@ -124,19 +124,19 @@ static char **headers() {
     return extraHeaders;
 }
 
-static int loadSingleUrlImage(struct loaderData_s *loaderData, struct iurlinfo *ui,
+static int loadSingleUrlImage(struct loaderData_s *loaderData, const char *src,
                               char *dest, char *mntpoint, int silentErrors) {
     char **ehdrs = NULL;
     int status;
 
-    if (!strncmp(ui->url, "http", 4))
+    if (!strncmp(src, "http", 4))
         ehdrs = headers();
 
-    status = urlinstTransfer(loaderData, ui, ehdrs, dest);
+    status = urlinstTransfer(loaderData, src, ehdrs, dest);
     if (status) {
         if (!silentErrors) {
             newtWinMessage(_("Error"), _("OK"),
-                           _("Unable to retrieve %s."), ui->url);
+                           _("Unable to retrieve %s."), src);
         }
 
         return 2;
@@ -181,7 +181,7 @@ static int loadUrlImages(struct loaderData_s *loaderData, struct iurlinfo *ui) {
      * ramdisk usage */
     checked_asprintf(&ui->url, "%s/%s", path, "updates.img");
 
-    if (!loadSingleUrlImage(loaderData, ui, "/tmp/updates-disk.img", "/tmp/update-disk", 1)) {
+    if (!loadSingleUrlImage(loaderData, ui->url, "/tmp/updates-disk.img", "/tmp/update-disk", 1)) {
         copyDirectory("/tmp/update-disk", "/tmp/updates", copyWarnFn,
                       copyErrorFn);
         umount("/tmp/update-disk");
@@ -198,7 +198,7 @@ static int loadUrlImages(struct loaderData_s *loaderData, struct iurlinfo *ui) {
      * ramdisk usage */
     checked_asprintf(&ui->url, "%s/%s", path, "product.img");
 
-    if (!loadSingleUrlImage(loaderData, ui, "/tmp/product-disk.img", "/tmp/product-disk", 1)) {
+    if (!loadSingleUrlImage(loaderData, ui->url, "/tmp/product-disk.img", "/tmp/product-disk", 1)) {
         copyDirectory("/tmp/product-disk", "/tmp/product", copyWarnFn,
                       copyErrorFn);
         umount("/tmp/product-disk");
@@ -211,7 +211,7 @@ static int loadUrlImages(struct loaderData_s *loaderData, struct iurlinfo *ui) {
 
     checked_asprintf(&dest, "/tmp/install.img");
 
-    rc = loadSingleUrlImage(loaderData, ui, dest, "/mnt/runtime", 0);
+    rc = loadSingleUrlImage(loaderData, ui->url, dest, "/mnt/runtime", 0);
     free(dest);
     free(oldUrl);
 
@@ -335,7 +335,7 @@ int getFileFromUrl(char * url, char * dest,
         ehdrs = headers();
     }
 
-    rc = urlinstTransfer(loaderData, &ui, ehdrs, dest);
+    rc = urlinstTransfer(loaderData, ui.url, ehdrs, dest);
     if (rc) {
         logMessage(ERROR, "failed to retrieve %s", ui.url);
         return 1;
diff --git a/loader/urls.c b/loader/urls.c
index be8f01e..4728890 100644
--- a/loader/urls.c
+++ b/loader/urls.c
@@ -121,7 +121,7 @@ int splitProxyParam(char *param, char **user, char **password, char **proxy) {
     return 1;
 }
 
-int urlinstTransfer(struct loaderData_s *loaderData, struct iurlinfo *ui,
+int urlinstTransfer(struct loaderData_s *loaderData, const char *src,
                     char **extraHeaders, char *dest) {
     struct progressCBdata *cb_data;
     CURL *curl = NULL;
@@ -130,7 +130,7 @@ int urlinstTransfer(struct loaderData_s *loaderData, struct iurlinfo *ui,
     char *version;
     FILE *f = NULL;
 
-    logMessage(INFO, "transferring %s", ui->url);
+    logMessage(INFO, "transferring %s", src);
 
     f = fopen(dest, "w");
 
@@ -141,7 +141,7 @@ int urlinstTransfer(struct loaderData_s *loaderData, struct iurlinfo *ui,
     checked_asprintf(&version, "anaconda/%s", VERSION);
 
     curl_easy_setopt(curl, CURLOPT_USERAGENT, version);
-    curl_easy_setopt(curl, CURLOPT_URL, ui->url);
+    curl_easy_setopt(curl, CURLOPT_URL, src);
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, f);
     curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
     curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10);
@@ -169,19 +169,19 @@ int urlinstTransfer(struct loaderData_s *loaderData, struct iurlinfo *ui,
         curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
     }
     
-    if (ui->noverifyssl) {
+    if (loaderData->instRepo_noverifyssl) {
         curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
     }
 
     /* Only set up the progress bar if we've got a UI to display it. */
     if (FL_CMDLINE(flags)) {
-        printf("%s %s...\n", _("Retrieving"), ui->url);
+        printf("%s %s...\n", _("Retrieving"), src);
     } else {
-        char *filename;
+        const char *filename;
 
-        filename = strrchr(ui->url, '/');
+        filename = strrchr(src, '/');
         if (!filename)
-           filename = ui->url;
+           filename = src;
 
         cb_data = winProgressBar(70, 5, _("Retrieving"), "%s %s...", _("Retrieving"), filename);
 
@@ -193,7 +193,7 @@ int urlinstTransfer(struct loaderData_s *loaderData, struct iurlinfo *ui,
     /* Finally, do the transfer. */
     status = curl_easy_perform(curl);
     if (status)
-        logMessage(ERROR, "Error downloading %s: %s", ui->url, curl_easy_strerror(status));
+        logMessage(ERROR, "Error downloading %s: %s", src, curl_easy_strerror(status));
 
     if (!FL_CMDLINE(flags))
        newtPopWindow();
diff --git a/loader/urls.h b/loader/urls.h
index c00e2ee..d55dfd4 100644
--- a/loader/urls.h
+++ b/loader/urls.h
@@ -32,7 +32,7 @@ void urlinfo_copy(struct iurlinfo *dst, const struct iurlinfo *src);
 
 int splitProxyParam(char *param, char **user, char **password, char **proxy);
 int urlMainSetupPanel(struct loaderData_s *loaderData);
-int urlinstTransfer(struct loaderData_s *loaderData, struct iurlinfo *ui,
+int urlinstTransfer(struct loaderData_s *loaderData, const char *src,
                     char **extraHeaders, char *dest);
 
 #endif
-- 
1.7.1.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]