// TODO fix these string return codes public bool _upload_external_curl() { Process curl = new Process(); curl.StartInfo.UseShellExecute = false; curl.StartInfo.FileName = "curl.exe"; curl.StartInfo.CreateNoWindow = true; curl.StartInfo.Arguments = "-k -l -v -H \"Authorization: Basic " + _node.auth_key() + "\" -H \"Etag: " + ETag + "\" -T \"" + local_path + "\" -X PUT \"" + b_http.url + "storage?path=" + path + "\""; curl.StartInfo.RedirectStandardOutput = true; curl.StartInfo.RedirectStandardError = true; bool started = curl.Start(); string output = curl.StandardOutput.ReadToEnd(); string error = curl.StandardError.ReadToEnd(); curl.WaitForExit(); httpresponse = new bHttpResponse(output, error); status = httpresponse.statuscode(); return httpresponse.status(); }
public bool download() { if (_blacklisted()) { status = "ignore list"; return true; } string directory = Path.GetDirectoryName(this.local_path); if (! File.Exists(directory)) { Directory.CreateDirectory(directory); } if (this.IsDirectory) { status = "directory"; return true; } Process curl = new Process(); Uri path_url = new Uri(b_http.url + "storage?path=" + this.path + "&version=1"); curl.StartInfo.UseShellExecute = false; curl.StartInfo.FileName = "curl.exe"; curl.StartInfo.CreateNoWindow = true; //curl.StartInfo.Arguments = "-k -v -H \"Authorization: Basic " + _node.auth_key() + "\" " + b_http.url + "storage?path=" + this.path + " -o \"" + local_path + "\""; curl.StartInfo.Arguments = "-k -v -H \"Authorization: Basic " + _node.auth_key() + "\" " + path_url.AbsoluteUri + " -o \"" + local_path + "\""; curl.StartInfo.RedirectStandardOutput = true; curl.StartInfo.RedirectStandardError = true; bool started = curl.Start(); string output = curl.StandardOutput.ReadToEnd(); string error = curl.StandardError.ReadToEnd(); curl.WaitForExit(); httpresponse = new bHttpResponse(output, error); status = httpresponse.statuscode(); return _existslocal(); }