@@ -391,6 +391,13 @@ static int get_cache_server_url(struct json_iterator *it)
391
391
return 0 ;
392
392
}
393
393
394
+ static int can_url_support_gvfs (const char * url )
395
+ {
396
+ return starts_with (url , "https://" ) ||
397
+ (git_env_bool ("GIT_TEST_ALLOW_GVFS_VIA_HTTP" , 0 ) &&
398
+ starts_with (url , "http://" ));
399
+ }
400
+
394
401
/*
395
402
* If `cache_server_url` is `NULL`, print the list to `stdout`.
396
403
*
@@ -402,6 +409,13 @@ static int supports_gvfs_protocol(const char *url, char **cache_server_url)
402
409
struct child_process cp = CHILD_PROCESS_INIT ;
403
410
struct strbuf out = STRBUF_INIT ;
404
411
412
+ /*
413
+ * The GVFS protocol is only supported via https://; For testing, we
414
+ * also allow http://.
415
+ */
416
+ if (!can_url_support_gvfs (url ))
417
+ return 0 ;
418
+
405
419
cp .git_cmd = 1 ;
406
420
strvec_pushl (& cp .args , "gvfs-helper" , "--remote" , url , "config" , NULL );
407
421
if (!pipe_command (& cp , NULL , 0 , & out , 512 , NULL , 0 )) {
@@ -470,19 +484,26 @@ static char *get_cache_key(const char *url)
470
484
struct strbuf out = STRBUF_INIT ;
471
485
char * cache_key = NULL ;
472
486
473
- cp .git_cmd = 1 ;
474
- strvec_pushl (& cp .args , "gvfs-helper" , "--remote" , url ,
475
- "endpoint" , "vsts/info" , NULL );
476
- if (!pipe_command (& cp , NULL , 0 , & out , 512 , NULL , 0 )) {
477
- char * id = NULL ;
478
- struct json_iterator it =
479
- JSON_ITERATOR_INIT (out .buf , get_repository_id , & id );
480
-
481
- if (iterate_json (& it ) < 0 )
482
- warning ("JSON parse error (%s)" , out .buf );
483
- else if (id )
484
- cache_key = xstrfmt ("id_%s" , id );
485
- free (id );
487
+ /*
488
+ * The GVFS protocol is only supported via https://; For testing, we
489
+ * also allow http://.
490
+ */
491
+ if (can_url_support_gvfs (url )) {
492
+ cp .git_cmd = 1 ;
493
+ strvec_pushl (& cp .args , "gvfs-helper" , "--remote" , url ,
494
+ "endpoint" , "vsts/info" , NULL );
495
+ if (!pipe_command (& cp , NULL , 0 , & out , 512 , NULL , 0 )) {
496
+ char * id = NULL ;
497
+ struct json_iterator it =
498
+ JSON_ITERATOR_INIT (out .buf , get_repository_id ,
499
+ & id );
500
+
501
+ if (iterate_json (& it ) < 0 )
502
+ warning ("JSON parse error (%s)" , out .buf );
503
+ else if (id )
504
+ cache_key = xstrfmt ("id_%s" , id );
505
+ free (id );
506
+ }
486
507
}
487
508
488
509
if (!cache_key ) {
0 commit comments