@@ -29,7 +29,7 @@ static debug_t _debugger;
2929 })
3030
3131struct repository_file_t {
32- const char * url ;
32+ char * url ;
3333 const char * dir ;
3434 const char * file ;
3535 const char * secret ;
@@ -87,7 +87,7 @@ http_get_response_t *repository_fetch_package_manifest(const char *package_url,
8787 char * manifest_url = repository_create_url_for_file (package_url , package_id , version , manifest_file , secret );
8888
8989 http_get_response_t * res ;
90- if (strstr (package_url , "gitlab" ) != NULL ) {
90+ if (secret && strstr (package_url , "gitlab" ) != NULL ) {
9191 char * key = "PRIVATE-TOKEN" ;
9292 unsigned int size = strlen (key ) + strlen (secret ) + 2 ;
9393 char * authentication_header = malloc (size );
@@ -98,6 +98,8 @@ http_get_response_t *repository_fetch_package_manifest(const char *package_url,
9898 res = http_get_shared (manifest_url , clib_package_curl_share , NULL , 0 );
9999 }
100100
101+ free (manifest_url );
102+
101103 return res ;
102104}
103105
@@ -116,7 +118,11 @@ repository_file_handle_t repository_download_package_file(const char *package_ur
116118
117119void repository_file_finish_download (repository_file_handle_t file ) {
118120 void * rc ;
119- pthread_join (file -> thread , & rc );
121+ int success = pthread_join (file -> thread , & rc );
122+ if (success != 0 ) {
123+ printf ("Failed to join thread.\n" );
124+ }
125+ free (rc );
120126}
121127
122128void repository_file_free (repository_file_handle_t file ) {
@@ -133,8 +139,6 @@ static int fetch_package_file_work(const char *url, const char *dir, const char
133139 return 1 ;
134140 }
135141
136- _debug ("file URL: %s" , url );
137-
138142 if (!(path = path_join (dir , basename (file )))) {
139143 rc = 1 ;
140144 goto cleanup ;
@@ -145,14 +149,14 @@ static int fetch_package_file_work(const char *url, const char *dir, const char
145149#endif
146150
147151 if (package_opts .force || -1 == fs_exists (path )) {
148- _debug ("repository" , " fetching %s" , url );
152+ _debug ("fetching %s" , url );
149153 fflush (stdout );
150154
151155#ifdef HAVE_PTHREADS
152156 pthread_mutex_unlock (& mutex );
153157#endif
154158
155- if (strstr (url , "gitlab" ) != NULL ) {
159+ if (secret && strstr (url , "gitlab" ) != NULL ) {
156160 char * key = "PRIVATE-TOKEN" ;
157161 unsigned int size = strlen (key ) + strlen (secret ) + 2 ;
158162 char * authentication_header = malloc (size );
@@ -186,7 +190,7 @@ static int fetch_package_file_work(const char *url, const char *dir, const char
186190#ifdef HAVE_PTHREADS
187191 pthread_mutex_lock (& mutex );
188192#endif
189- _debug ("repository" , " saved %s" , path );
193+ _debug ("saved %s" , path );
190194 fflush (stdout );
191195#ifdef HAVE_PTHREADS
192196 pthread_mutex_unlock (& mutex );
0 commit comments