@@ -646,22 +646,31 @@ int gfal_http_copy(plugin_handle plugin_data, gfal2_context_t context,
646
646
set_copy_mode_from_urls (context,src_full, dst_full);
647
647
// Initial copy mode
648
648
CopyMode copy_mode = get_default_copy_mode (context);
649
-
649
+
650
+ bool only_streaming = false ;
650
651
// If source is not even http, go straight to streamed
651
652
// or if third party copy is disabled, go straight to streamed
652
653
if (!is_http_scheme (src) || !is_http_3rdcopy_enabled (context)) {
653
654
copy_mode = HTTP_COPY_STREAM;
655
+ only_streaming = true ;
654
656
}
655
657
656
658
// Re-try different approaches
657
659
int ret = 0 ;
660
+
661
+ CopyMode end_copy_mode = HTTP_COPY_END;
662
+
663
+ // if streaming is disabled stop the loop before
664
+ if (!is_http_streamed_enabled (context)) {
665
+ end_copy_mode = HTTP_COPY_STREAM;
666
+ }
667
+
658
668
do {
659
669
// The real, actual, copy
660
670
plugin_trigger_event (params, http_plugin_domain,
661
671
GFAL_EVENT_NONE, GFAL_EVENT_TRANSFER_ENTER,
662
672
" %s => %s" , src_full, dst_full);
663
- gfal2_log (G_LOG_LEVEL_MESSAGE,
664
- " Trying copying with mode %s" ,
673
+ gfal2_log (G_LOG_LEVEL_MESSAGE, " Trying copying with mode %s" ,
665
674
CopyModeStr[copy_mode]);
666
675
plugin_trigger_event (params, http_plugin_domain,
667
676
GFAL_EVENT_NONE, GFAL_EVENT_TRANSFER_TYPE,
@@ -675,7 +684,8 @@ int gfal_http_copy(plugin_handle plugin_data, gfal2_context_t context,
675
684
checksum_mode, checksum_type, user_checksum,
676
685
params, &nested_error);
677
686
}
678
- else {
687
+ else if (only_streaming) {
688
+ ret = -1 ;
679
689
gfalt_set_error (&nested_error, http_plugin_domain, EIO, __func__,
680
690
GFALT_ERROR_TRANSFER, " STREAMED DISABLED" ,
681
691
" Trying to fallback to a streamed copy, but they are disabled" );
@@ -691,18 +701,17 @@ int gfal_http_copy(plugin_handle plugin_data, gfal2_context_t context,
691
701
break ;
692
702
}
693
703
else if (ret < 0 ) {
694
-
695
- plugin_trigger_event (params, http_plugin_domain,
696
- GFAL_EVENT_NONE, GFAL_EVENT_TRANSFER_EXIT,
697
- " ERROR: Copy failed with mode %s, with error: %s" ,
698
- CopyModeStr[copy_mode], nested_error->message );
704
+ g_prefix_error (&nested_error, " ERROR: Copy failed with mode %s, with error: " ,CopyModeStr[copy_mode]);
705
+ plugin_trigger_event (params, http_plugin_domain,
706
+ GFAL_EVENT_NONE, GFAL_EVENT_TRANSFER_EXIT,
707
+ nested_error->message );
699
708
// Delete any potential destination file.
700
- gfal_http_copy_cleanup (plugin_data, dst, &nested_error);
709
+ gfal_http_copy_cleanup (plugin_data, dst, &nested_error);
701
710
}
702
711
703
712
copy_mode = (CopyMode)((int )copy_mode + 1 );
704
713
705
- } while ((copy_mode < HTTP_COPY_END ) && is_http_3rdcopy_fallback_enabled (context));
714
+ } while ((copy_mode < end_copy_mode ) && is_http_3rdcopy_fallback_enabled (context));
706
715
707
716
708
717
plugin_trigger_event (params, http_plugin_domain,
0 commit comments