Dan Fandrich | 1 Nov 01:21 2008

Re: Client using Curl-7.19.0/C-ares-1.5.3 gives linking problems

On Fri, Oct 31, 2008 at 02:58:29PM -0700, Jovial Shah wrote:
> That helps. I'm linking it statically right now.  Do you mean I should
> stick the output of 'curl-config --static-libs' in the link options of
> my client app ?

Yes.  Something like this in a makefile should do:

all:
	g++ -o myapp myapp.o $(shell curl-config --static-libs)

> Here's the error I see,
> :
> :
> Linking SamplePackage_unittest:                                    [ERROR]
> /workplace/jovial/runtime/bin/ld-t-wrap --wrap STDERR -o
> /workplace/jovial/build/SamplePackage/X86_LINUX_GCC32_GLIBC23/DEV.STD.PTHREAD/build/test/SamplePackage_unittest.ldmap
> /usr/bin/g++ -L/workplace/jovial/build/SamplePackage/SamplePackage-1.0/X86_LINUX_GCC32_GLIBC23/DEV.STD.PTHREAD/build/lib
> -L/workplace/jovial/build/Curl/Curl-7.19.0/X86_LINUX_GCC32_GLIBC23/DEV.STD.PTHREAD/build/lib
> -Wl,-rpath, private/SamplePackage/unittest/SamplePackageTest.o
> -Wl,-Bstatic -Wl,-Bdynamic -lrt -lpthread -Wl,-Bstatic
> -lSamplePackageTest -lcurl -lresolv -Wl,-Bdynamic -lrt -lpthread
> -Wl,-Bstatic -Wl,-Bdynamic -lrt -ldl -lm -o
> /workplace/jovial/build/SamplePackage/SamplePackage-1.0/X86_LINUX_GCC32_GLIBC23/DEV.STD.PTHREAD/build/test/SamplePackage_unittest

I don't see any mention of the ares library in there.

>>> Dan
--

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
(Continue reading)

Daniel Stenberg | 1 Nov 15:53 2008
Picon

Re: cant reach c-ares site

On Sat, 1 Nov 2008, Guenter Knauf wrote:

> I cant currently reach the c-ares site at

The machine hosting it went dead this morning. It just went back up. The same 
host serves a bunch of other services too such as the mailing lists for both 
these projects...

> and BTW. woulnt it be nice if you would create a host entry for c-ares, like 
> we have for curl: http://c-ares.haxx.se/

Yeah, I agree that'd be a better address. I'll work on that.

Anyone feels like drawing a c-ares logo? ;-)

--

-- 

  / daniel.haxx.se

changqin_gang | 1 Nov 11:08 2008

Big problem: uploaded sFtp file's size is 0KB!

As the code below shows, it succesfully created a file on specified sFtp server dierectory, however, the file's size was ZERO! No matter what the local file's size was!  

Why? Any thing wrong?

Any help is 
grateful!

===============CODE==================

static size_t read_callback(void * pBuffer, size_t size, size_t nmemb, void * hFile)
{
        DWORD dwNumberOfBytesRead = 0;
        BOOL bResult = ReadFile( (HANDLE) hFile, pBuffer, size * nmemb, &dwNumberOfBytesRead, NULL);
        return dwNumberOfBytesRead;
}

bool sFTPUpload(CString bsFileFullPath, CString bsFtpWorkPath, CString bsFileRltPath, CString bsUserPassword)
{
        USES_CONVERSION;

        FILE *hFile;
        char * lpszCurlErrorBuffer[CURL_ERROR_SIZE];
        CURLcode nCurlResult = CURL_LAST;
        struct stat file_info;

        DWORD dwLastError;

        /*open the uploading file*/
        int hd ;
        hd = open(bsFileFullPath, O_RDONLY) ;
        fstat(hd, &file_info);
        close(hd) ;

        hFile = fopen(bsFileFullPath, "r");
        
        if (hFile == INVALID_HANDLE_VALUE)
        {
              dwLastError = GetLastError();
              printf("open file failed!\n%s\nDiscribe:%s",bsFileFullPath, dwLastError);              
              curl_global_cleanup();
              return false;
        }
        else  printf("open file OK!\n%s\n",bsFileFullPath);

        /*begin init*/
        curl_global_init(CURL_GLOBAL_ALL);

        CURL * hCurl = curl_easy_init();
        if (!hCurl)
        {
            curl_global_cleanup();
            printf("CURL-Library easy_init failed \n");
            return false;
        }
        printf("CURL-Library init OK!\n");

        /*begin easy_handle*/
        {
            struct curl_slist * headerlist = NULL;
    
            CString sFTPPath = bsFtpWorkPath + bsFileRltPath;
            printf("setopt remote_url:%s\n",sFTPPath);
        
            /* enable error buffer */
            curl_easy_setopt(hCurl, CURLOPT_ERRORBUFFER, lpszCurlErrorBuffer) ;
            curl_easy_setopt(hCurl, CURLOPT_VERBOSE, 1);

            /* enable uploading */
            curl_easy_setopt(hCurl, CURLOPT_UPLOAD, TRUE) ;

            curl_easy_setopt(hCurl,CURLOPT_TRANSFERTEXT, TRUE) ;

            /* specify target */    
            curl_easy_setopt(hCurl, CURLOPT_URL, sFTPPath);

            /* read function */
            curl_easy_setopt(hCurl, CURLOPT_READFUNCTION, read_callback);

            /* now specify which file to upload */
            curl_easy_setopt(hCurl, CURLOPT_READDATA, hFile);

            curl_easy_setopt(hCurl, CURLOPT_USERPWD, bsUserPassword);

            curl_easy_setopt(hCurl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size);

            /* Now do perform! */
            nCurlResult = curl_easy_perform(hCurl);

            /* clean up the FTP commands list */
            curl_slist_free_all (headerlist);

            /* always cleanup */
            curl_easy_cleanup(hCurl);
        }

        fclose(hFile); /* close the local file */

        curl_global_cleanup();

        if (nCurlResult == CURLE_OK)
        {
            printf("upload succeed!\n");
            return true;
        }

       return false;
}


int main()
{
    CString LocalFilefullpath,ServerWorkPath,sFtpFileRltpath,UserPwd;
    LocalFilefullpath = "C:\\Documents and Settings\\user\\desktop\\synctest\\test.txt";
    ServerWorkPath = "sftp://192.168.1.166/home/user/";
    sFtpFileRltpath = "synctest/test.txt";
    UserPwd = "user:pwd";

    sFTPUpload(LocalFilefullpath, ServerWorkPath,sFtpFileRltpath,UserPwd);

    return 0;
}


新浪空间——与朋友开心分享网络新生活!
Dan Fandrich | 1 Nov 17:06 2008

libcurl version number

Just a friendly reminder to bump the "age" field of the libcurl.so version
number before the release.  That seems to be forgotten more times than
not...

>>> Dan
--

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved

Dan Fandrich | 1 Nov 17:09 2008

Re: Big problem: uploaded sFtp file's size is 0KB!

On Sat, Nov 01, 2008 at 06:08:58PM +0800, changqin_gang wrote:
> As the code below shows, it succesfully created a file on specified sFtp server
> dierectory, however, the file's size was ZERO! No matter what the local file's
> size was!  
> 
> Why? Any thing wrong?

>         BOOL bResult = ReadFile( (HANDLE) hFile, pBuffer, size * nmemb, &
> dwNumberOfBytesRead, NULL);
[...]> 
>         hFile = fopen(bsFileFullPath, "r");

Can you really call ReadFile() on a handle opened by fopen()? I suspect not...

>>> Dan
--

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved

Jeff Pohlmeyer | 1 Nov 19:35 2008
Picon

Re: cant reach c-ares site

Daniel Stenberg <daniel <at> haxx.se> wrote:

> Anyone feels like drawing a c-ares logo? ;-)

Well, it's not exactly a Picasso, but maybe this will do...

  http://yetanothergeek.fileave.com/ares-logo.html

 - Jeff

Daniel Stenberg | 1 Nov 19:33 2008
Picon

Re: UML diagram (was RE: SSL and basic authentication.)

On Fri, 31 Oct 2008, Dan Fandrich wrote:

> I used dia to generate that diagram. I can mail the source to anyone who
> wants to take it on.

Fire it away here to let everyone have a go at it. Quite possibly we could 
even commit it to CVS once we think it is reasonably accurate and up-to-date.

--

-- 

  / daniel.haxx.se

Daniel Stenberg | 1 Nov 19:33 2008
Picon

Re: libcurl issue with IPv6 and c-ares

On Sat, 11 Oct 2008, Daniel Johnson wrote:

>> From a pragmatic point of view it might be easier to teach libcurl to make 
>> two separate ares queries in this case.  Would you like to try making a 
>> patch for that?
>
> I had thought about this and agree that it would solve the problem, but 
> wasn't sure if it was the best solution. I'll look at the code and see if I 
> can come up with something.

Did you get anywhere on this road?

--

-- 

  / daniel.haxx.se

Meir Yanovich | 1 Nov 07:00 2008
Picon

curl_easy_init() failed within thread excution

Hello all
i have strange problem when i init cUrl with single threaded every
thing is fine
but when i start more threads each thread created new curl wrapper object
in the part :

CURL *m_pcurl;
m_pcurl = curl_easy_init();

its just failed , my question is how can i print some debug info to
get any hints about why it crashes
im using win xp with vs express
Thanks allot

Theodore H. Smith | 1 Nov 20:22 2008

Re: curl_easy_init() failed within thread excution


On 1 Nov 2008, at 06:00, Meir Yanovich wrote:

> Hello all
> i have strange problem when i init cUrl with single threaded every
> thing is fine
> but when i start more threads each thread created new curl wrapper  
> object
> in the part :
>
> CURL *m_pcurl;
> m_pcurl = curl_easy_init();

You need to call curl_easy_init from within the same thread that owns  
the global curl thing. The global curl thing is created when you first  
use curl_easy_init.

I think that means you can only access curl from one thread.

> its just failed , my question is how can i print some debug info to
> get any hints about why it crashes
> im using win xp with vs express
> Thanks allot

--
http://elfdata.com/plugin/
"String processing, done right"


Gmane