Cleanup() 공개 메소드

Cleanup unmanaged resources.
public Cleanup ( ) : void
리턴 void
예제 #1
1
파일: qc.cs 프로젝트: bluejack2000/core
        public static bool gopost(string url, string user, string password,  string data, TradeLink.API.DebugDelegate deb, out string result)
        {
            debs = deb;
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();
            rresult = new StringBuilder();
            hasresult = false;

            Easy.WriteFunction wf = new Easy.WriteFunction(OnWritePostData);
            easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
            Easy.DebugFunction df = new Easy.DebugFunction(OnDebug);
            easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);

            // simple post - with a string
            easy.SetOpt(CURLoption.CURLOPT_POSTFIELDS,
                data);
            Slist sl = new Slist();
            sl.Append("Content-Type:application/xml");
            sl.Append("Accept: application/xml");
            easy.SetOpt(CURLoption.CURLOPT_HTTPHEADER, sl);
            easy.SetOpt(CURLoption.CURLOPT_SSL_VERIFYPEER, false);
            easy.SetOpt(CURLoption.CURLOPT_USERAGENT,
                "Mozilla 4.0 (compatible; MSIE 6.0; Win32");
            easy.SetOpt(CURLoption.CURLOPT_FOLLOWLOCATION, true);
            easy.SetOpt(CURLoption.CURLOPT_USERPWD, user + ":" + password);
            CURLhttpAuth authflag = CURLhttpAuth.CURLAUTH_BASIC;
            easy.SetOpt(CURLoption.CURLOPT_HTTPAUTH, authflag);
            easy.SetOpt(CURLoption.CURLOPT_URL,url);
            
            easy.SetOpt(CURLoption.CURLOPT_POST, true);
            if (debs!=null)
                easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);
            


            CURLcode err = easy.Perform();
            int waits = 0;
            int maxwaits = 200;
            while (!hasresult && (waits++<maxwaits))
                System.Threading.Thread.Sleep(10);

            int rcodei = 0;
            CURLcode rcode = easy.GetInfo(CURLINFO.CURLINFO_RESPONSE_CODE, ref rcodei);


            if (!hasresult && (deb != null))
                deb(easy.StrError(err));

            easy.Cleanup();



            Curl.GlobalCleanup();
            result = rresult.ToString();



            return hasresult;
        }
예제 #2
1
        public static void PerformPostMultipartRequest(string query, string postData)
        {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();

            Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);
            easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);

            // simple post - with a string
            easy.SetOpt(CURLoption.CURLOPT_POSTFIELDS,
                postData);

            easy.SetOpt(CURLoption.CURLOPT_USERAGENT,
                "C# EchoNest Lib");
            easy.SetOpt(CURLoption.CURLOPT_FOLLOWLOCATION, true);
            easy.SetOpt(CURLoption.CURLOPT_URL,
                query);
            easy.SetOpt(CURLoption.CURLOPT_POST, true);

            CURLcode res = easy.Perform();

            if (res != CURLcode.CURLE_OK)
                throw new WebException("Post operation failed");

            easy.Cleanup();

            Curl.GlobalCleanup();
        }
예제 #3
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();

            Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);
            easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);

            // simple post - with a string
            easy.SetOpt(CURLoption.CURLOPT_POSTFIELDS,
                "url=index%3Dstripbooks&field-keywords=Topology&Go.x=10&Go.y=10");

            easy.SetOpt(CURLoption.CURLOPT_USERAGENT,
                "Mozilla 4.0 (compatible; MSIE 6.0; Win32");
            easy.SetOpt(CURLoption.CURLOPT_FOLLOWLOCATION, true);
            easy.SetOpt(CURLoption.CURLOPT_URL,
                "http://www.amazon.com/exec/obidos/search-handle-form/002-5928901-6229641");
            easy.SetOpt(CURLoption.CURLOPT_POST, true);
     
            easy.Perform();
            easy.Cleanup();

            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
예제 #4
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();

            Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);
            easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);

            Easy.SSLContextFunction sf = new Easy.SSLContextFunction(OnSSLContext);
            easy.SetOpt(CURLoption.CURLOPT_SSL_CTX_FUNCTION, sf);

            easy.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy.SetOpt(CURLoption.CURLOPT_CAINFO, "ca-bundle.crt");

            easy.Perform();
            easy.Cleanup();

            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
예제 #5
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);

            Easy easy1 = new Easy();
            String s1 = (String)args[0].Clone();
            easy1.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy1.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
            easy1.SetOpt(CURLoption.CURLOPT_WRITEDATA, s1);

            Easy easy2 = new Easy();
            String s2 = (String)args[1].Clone();
            easy2.SetOpt(CURLoption.CURLOPT_URL, args[1]);
            easy2.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
            easy2.SetOpt(CURLoption.CURLOPT_WRITEDATA, s2);

            Multi multi = new Multi();
            multi.AddHandle(easy1);
            multi.AddHandle(easy2);

            int stillRunning = 1;
            // call Multi.Perform right away (note ref qualifier)
            while (multi.Perform(ref stillRunning) ==
                CURLMcode.CURLM_CALL_MULTI_PERFORM);

            while (stillRunning != 0)
            {
                multi.FDSet();
                int rc = multi.Select(1000); // one second
                switch(rc)
                {
                    case -1:
                        Console.WriteLine("Multi.Select() returned -1");
                        stillRunning = 0;
                        break;

                    case 0:
                    default:
                    {
                        while (multi.Perform(ref stillRunning) ==
                            CURLMcode.CURLM_CALL_MULTI_PERFORM);
                        break;
                    }
                }
            }

            // various cleanups
            multi.Cleanup();
            easy1.Cleanup();
            easy2.Cleanup();
            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
예제 #6
0
 public void ThreadFunc() {
     Easy easy = new Easy();
     easy.SetOpt(CURLoption.CURLOPT_URL, url);
     easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
     easy.SetOpt(CURLoption.CURLOPT_WRITEDATA, url);
     easy.SetOpt(CURLoption.CURLOPT_SHARE, share);
     easy.Perform();
     easy.Cleanup();
 }
예제 #7
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            // <form action="http://mybox/cgi-bin/myscript.cgi
            //  method="post" enctype="multipart/form-data">
            MultiPartForm mf = new MultiPartForm();

            // <input name="frmUsername">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmUsername",
                CURLformoption.CURLFORM_COPYCONTENTS, "testtcc",
                CURLformoption.CURLFORM_END);

            // <input name="frmPassword">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmPassword",
                CURLformoption.CURLFORM_COPYCONTENTS, "tcc",
                CURLformoption.CURLFORM_END);

            // <input name="frmFileOrigPath">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmFileOrigPath",
                CURLformoption.CURLFORM_COPYCONTENTS, args[1],
                CURLformoption.CURLFORM_END);

            // <input name="frmFileDate">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmFileDate",
                CURLformoption.CURLFORM_COPYCONTENTS, "08/01/2004",
                CURLformoption.CURLFORM_END);

            // <input type="File" name="f1">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "f1",
                CURLformoption.CURLFORM_FILE, args[1],
                CURLformoption.CURLFORM_CONTENTTYPE, "application/binary",
                CURLformoption.CURLFORM_END);

            Easy easy = new Easy();
 
            Easy.DebugFunction df = new Easy.DebugFunction(OnDebug);
            easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);
            easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);

            Easy.ProgressFunction pf = new Easy.ProgressFunction(OnProgress);
            easy.SetOpt(CURLoption.CURLOPT_PROGRESSFUNCTION, pf);

            easy.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy.SetOpt(CURLoption.CURLOPT_HTTPPOST, mf);

            easy.Perform();
            easy.Cleanup();
            mf.Free();

            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
예제 #8
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();
            Easy.HeaderFunction hf = new Easy.HeaderFunction(OnHeaderData);

            easy.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy.SetOpt(CURLoption.CURLOPT_HEADERFUNCTION, hf);
            easy.Perform();
            easy.Cleanup();

            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
예제 #9
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            FileStream fs = new FileStream(args[0], FileMode.Open,
                FileAccess.Read, FileShare.Read);

            Easy easy = new Easy();

            Easy.ReadFunction rf = new Easy.ReadFunction(OnReadData);
            easy.SetOpt(CURLoption.CURLOPT_READFUNCTION, rf);
            easy.SetOpt(CURLoption.CURLOPT_READDATA, fs);
          
            Easy.DebugFunction df = new Easy.DebugFunction(OnDebug);
            easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);
            easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);

            Easy.ProgressFunction pf = new Easy.ProgressFunction(OnProgress);
            easy.SetOpt(CURLoption.CURLOPT_PROGRESSFUNCTION, pf);

            easy.SetOpt(CURLoption.CURLOPT_URL, args[1]);
            easy.SetOpt(CURLoption.CURLOPT_USERPWD,
                args[2] + ":" + args[3]);
            easy.SetOpt(CURLoption.CURLOPT_UPLOAD, true);
            easy.SetOpt(CURLoption.CURLOPT_INFILESIZE, fs.Length);

            easy.Perform();
            easy.Cleanup();

            fs.Close();

            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
예제 #10
0
파일: qc.cs 프로젝트: bluejack2000/core
        public static bool gomultipartpost(string url, string user, string password, string fname, string fpath, int ticketid,int maxwaitsec, bool showprogress, TradeLink.API.DebugDelegate deb, out string result)
        {
            debs = deb;
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();
            rresult = new StringBuilder();
            hasresult = false;

            MultiPartForm mf = new MultiPartForm();


            // <input name="frmFileOrigPath">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "document[name]",
                CURLformoption.CURLFORM_COPYCONTENTS, fname,
                CURLformoption.CURLFORM_END);



            // <input type="File" name="f1">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "document[file]",
                CURLformoption.CURLFORM_FILE, fpath,
                CURLformoption.CURLFORM_CONTENTTYPE, "application/octet-stream",
                CURLformoption.CURLFORM_END);

            // <input name="frmFileDate">
            if (ticketid != 0)
                mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "document[ticket_id]",
                    CURLformoption.CURLFORM_COPYCONTENTS, ticketid.ToString(),
                    CURLformoption.CURLFORM_END);

            if (showprogress)
            {
                Easy.ProgressFunction pf = new Easy.ProgressFunction(OnProgress);
                easy.SetOpt(CURLoption.CURLOPT_PROGRESSFUNCTION, pf);
            }


            Easy.WriteFunction wf = new Easy.WriteFunction(OnWritePostData);
            easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
            easy.SetOpt(CURLoption.CURLOPT_HTTPPOST, mf);
            Easy.DebugFunction df = new Easy.DebugFunction(OnDebug);
            easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);

            // simple post - with a string
            //easy.SetOpt(CURLoption.CURLOPT_POSTFIELDS,data);
            Slist sl = new Slist();
            //sl.Append("Content-Type:multipart/form-data");
            sl.Append("Accept: application/xml");
            easy.SetOpt(CURLoption.CURLOPT_HTTPHEADER, sl);
            easy.SetOpt(CURLoption.CURLOPT_SSL_VERIFYPEER, false);
            easy.SetOpt(CURLoption.CURLOPT_USERAGENT,
                "Mozilla 4.0 (compatible; MSIE 6.0; Win32");
            easy.SetOpt(CURLoption.CURLOPT_FOLLOWLOCATION, true);
            easy.SetOpt(CURLoption.CURLOPT_USERPWD, user + ":" + password);
            CURLhttpAuth authflag = CURLhttpAuth.CURLAUTH_BASIC;
            easy.SetOpt(CURLoption.CURLOPT_HTTPAUTH, authflag);
            easy.SetOpt(CURLoption.CURLOPT_URL, url);

            //easy.SetOpt(CURLoption.CURLOPT_POST, true);
            if (debs != null)
                easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);



            CURLcode err = easy.Perform();
            int waits = 0;
            int maxwaits = 100*maxwaitsec;
            while (!hasresult && (waits++ < maxwaits))
                System.Threading.Thread.Sleep(10);

            int rcodei = 0;
            CURLcode rcode = easy.GetInfo(CURLINFO.CURLINFO_RESPONSE_CODE, ref rcodei);


            if (!hasresult && (deb != null))
                deb(easy.StrError(err));

            easy.Cleanup();
            mf.Free();


            Curl.GlobalCleanup();
            result = rresult.ToString();



            return hasresult && (rcodei==201);
        }
예제 #11
0
        public string GetPostPage(string url, string postData, string proxyPort, string userPassword, bool deleteCookies = true)
        {
            lock(thisLock){

                if(deleteCookies)
                    DeleteCookies();

                Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);
                Easy easy = new Easy();
                try
                {
                    this.CurrentPage = string.Empty;
                    Easy.WriteFunction wf = this.WriteData;
                    easy.SetOpt(CURLoption.CURLOPT_URL, url);
                    easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
                    easy.SetOpt(CURLoption.CURLOPT_SSL_VERIFYHOST, 0);
                    easy.SetOpt(CURLoption.CURLOPT_SSL_VERIFYPEER, 0);
                    if (!string.IsNullOrEmpty(proxyPort)) easy.SetOpt(CURLoption.CURLOPT_PROXY, proxyPort);
                    if (!string.IsNullOrEmpty(userPassword)) easy.SetOpt(CURLoption.CURLOPT_PROXYUSERPWD, userPassword);
                    if (!string.IsNullOrEmpty(proxyPort)) easy.SetOpt(CURLoption.CURLOPT_PROXYTYPE, CURLproxyType.CURLPROXY_SOCKS5);
                    easy.SetOpt(CURLoption.CURLOPT_USERAGENT, UserAgent);
                    easy.SetOpt(CURLoption.CURLOPT_COOKIEFILE, "injector.cookie");
                    easy.SetOpt(CURLoption.CURLOPT_COOKIEJAR, "injector.cookie");
                    easy.SetOpt(CURLoption.CURLOPT_FOLLOWLOCATION, 1);
                    easy.SetOpt(CURLoption.CURLOPT_AUTOREFERER, 1);
                    easy.SetOpt(CURLoption.CURLOPT_CONNECTTIMEOUT, 15);
                    if (!string.IsNullOrEmpty(postData)) easy.SetOpt(CURLoption.CURLOPT_POSTFIELDS, postData);
                    easy.Perform();
                    return this.CurrentPage;

                }
                catch (Exception exp){
                    if(exp is ThreadAbortException){
                        this.CurrentPage = string.Empty;
                    }
                    Cache.Instance.Log("[GetPostPage] Exception " + exp.ToString());
                }
                finally
                {
                    if (easy != null)
                        easy.Cleanup();
                    Curl.GlobalCleanup();
                }
                return this.CurrentPage = string.Empty;
            }
        }
예제 #12
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();
            easy.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy.SetOpt(CURLoption.CURLOPT_PRIVATE, "Private string");
            easy.SetOpt(CURLoption.CURLOPT_FILETIME, true);
            easy.Perform();

            // now, exercise the various GetInfo stuff
            double d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_CONNECT_TIME, ref d);
            Console.WriteLine("Connect Time: {0}", d);

            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_CONTENT_LENGTH_DOWNLOAD, ref d);
            Console.WriteLine("Content Length (Download): {0}", d);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_CONTENT_LENGTH_UPLOAD, ref d);
            Console.WriteLine("Content Length (Upload): {0}", d);
    
            string s = null;
            easy.GetInfo(CURLINFO.CURLINFO_CONTENT_TYPE, ref s);
            Console.WriteLine("Content Type: {0}", s);
    
            DateTime dt = new DateTime(0);
            easy.GetInfo(CURLINFO.CURLINFO_FILETIME, ref dt);
            Console.WriteLine("File time: {0}", dt);
    
            int n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_HEADER_SIZE, ref n);
            Console.WriteLine("Header Size: {0}", n);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_HTTPAUTH_AVAIL, ref n);
            Console.WriteLine("Authentication Bitmask: {0}", n);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_HTTP_CONNECTCODE, ref n);
            Console.WriteLine("HTTP Connect Code: {0}", n);
    
            d = 0.0;            
            easy.GetInfo(CURLINFO.CURLINFO_NAMELOOKUP_TIME, ref d);
            Console.WriteLine("Name Lookup Time: {0}", d);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_OS_ERRNO, ref n);
            Console.WriteLine("OS Errno: {0}", n);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_PRETRANSFER_TIME, ref d);
            Console.WriteLine("Pretransfer time: {0}", d);
    
            object o = null;
            easy.GetInfo(CURLINFO.CURLINFO_PRIVATE, ref o);
            Console.WriteLine("Private Data: {0}", o);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_PROXYAUTH_AVAIL, ref n);
            Console.WriteLine("Proxy Authentication Schemes: {0}", n);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_REDIRECT_COUNT, ref n);
            Console.WriteLine("Redirect count: {0}", n);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_REDIRECT_TIME, ref d);
            Console.WriteLine("Redirect time: {0}", d);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_REQUEST_SIZE, ref n);
            Console.WriteLine("Request size: {0}", n);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_RESPONSE_CODE, ref n);
            Console.WriteLine("Response code: {0}", n);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_SIZE_DOWNLOAD, ref d);
            Console.WriteLine("Download size: {0}", d);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_SIZE_UPLOAD, ref d);
            Console.WriteLine("Upload size: {0}", d);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_SPEED_DOWNLOAD, ref d);
            Console.WriteLine("Download speed: {0}", d);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_SPEED_UPLOAD, ref d);
            Console.WriteLine("Upload speed: {0}", d);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_SSL_VERIFYRESULT, ref n);
            Console.WriteLine("SSL verification result: {0}", n);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_STARTTRANSFER_TIME, ref d);
            Console.WriteLine("Start transfer time: {0}", d);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_TOTAL_TIME, ref d);
            Console.WriteLine("Total time: {0}", d);
    
            easy.Cleanup();
            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
예제 #13
0
 private void CleanupCurl()
 {
     easy.Cleanup();
     LibCurl.Curl.GlobalCleanup();
 }
예제 #14
0
        //currently used in: wolfram, steam
        private void sendRequest(string waurl, Easy.WriteFunction wf, string upload)
        {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);
            Easy easy = new Easy();

            Easy.DebugFunction df = new Easy.DebugFunction(OnDebug);
            easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);
            //easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);
            easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
            easy.SetOpt(CURLoption.CURLOPT_URL, waurl);
            if(upload != "")
                easy.SetOpt(CURLoption.CURLOPT_POSTFIELDS, upload);

            easy.Perform();
            easy.Cleanup();
            Curl.GlobalCleanup();
        }