예제 #1
0
        internal static void AppendSettings(
            this ProcessArgumentBuilder arguments,
            CurlSettings settings)
        {
            if (settings.Verbose)
            {
                arguments.Append("--verbose");
            }

            if (settings.ProgressBar)
            {
                arguments.Append("--progress-bar");
            }

            if (settings.Username != null)
            {
                arguments.AppendSwitchQuoted(
                    "--user",
                    $"{settings.Username}:{settings.Password}");
            }

            if (settings.Insecure)
            {
                arguments.Append("--insecure");
            }

            if (settings.CaCertFile != null)
            {
                arguments.AppendSwitchQuoted(
                    "--cacert",
                    $"{settings.CaCertFile}");
            }

            if (settings.Headers != null)
            {
                foreach (var item in settings.Headers)
                {
                    arguments.AppendSwitchQuoted(
                        "--header",
                        $"{item.Key}:{item.Value}");
                }
            }

            if (settings.RequestCommand != null)
            {
                arguments.AppendSwitchQuoted(
                    "--request",
                    settings.RequestCommand.ToUpperInvariant());
            }

            if (settings.FollowRedirects)
            {
                arguments.Append("--location");
            }
        }
예제 #2
0
        public static void CurlUploadFile(
            this ICakeContext context,
            FilePath filePath,
            Uri host,
            CurlSettings settings)
        {
            var runner = new CurlUploadRunner(
                context.FileSystem,
                context.Environment,
                context.ProcessRunner,
                context.Tools);

            runner.UploadFile(filePath, host, settings);
        }