]> git.street.me.uk Git - andy/viking.git/commitdiff
Improve hostname/uri usage
authorRob Norris <rw_norris@hotmail.com>
Fri, 17 Feb 2017 22:27:24 +0000 (22:27 +0000)
committerRob Norris <rw_norris@hotmail.com>
Mon, 27 Feb 2017 23:25:32 +0000 (23:25 +0000)
Allow putting '://' in hostname i.e. to support https addresses.

src/curl_download.c

index 1f5deff00346bb8e8cda8ca98b260bd20fb24e76..56b6fbe83fa7689aa41cfd987e878c834d967bcc 100644 (file)
@@ -195,9 +195,14 @@ CURL_download_t curl_download_get_url ( const char *hostname, const char *uri, F
 {
   gchar *full = NULL;
 
-  if ( hostname && strstr ( hostname, "://" ) != NULL )
-    /* Already full url */
-    full = (gchar *) hostname;
+  if ( hostname && strstr ( hostname, "://" ) != NULL ) {
+    if ( uri && strlen ( uri ) > 1 )
+      // Simply append them together
+      full = g_strdup_printf ( "%s%s", hostname, uri );
+    else
+      /* Already full url */
+      full = (gchar *) hostname;
+  }
   else if ( uri && strstr ( uri, "://" ) != NULL )
     /* Already full url */
     full = (gchar *) uri;