cURL / Mailing Lists / curl-library / Single Mail

curl-library

Program using libcurl has problem of OS dependent

From: 时有 <shiyou_at_nextbase.cn>
Date: Wed, 25 Jul 2007 12:41:41 +0800

Hi all,

        I write a program using libcurl HTTPPOST method. It run sucessfully in RHEL_4, but the same program has different problems when it run in Redhat 9(shrike)&Fedora 7. All the libcurl version is 7.16.4. May be the problem is libcurl version is not right for Redhat 9 & Fedora 7. I have try to find the right version, but cann't get that one.
////////////////////////////////////////////////////////////////////
    The part of source code:

        res = curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
        res = curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &config);

        /* what URL that receives this POST */
        res = curl_easy_setopt(curl, CURLOPT_URL, ac_url);
        res = curl_easy_setopt(curl, CURLOPT_VERBOSE,1);
        res = curl_easy_setopt(curl, CURLOPT_HEADER,1);
    res = curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
        res = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,NULL);
        res = curl_easy_setopt(curl, CURLOPT_WRITEDATA ,fp_login);
        
        res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
        
        res = curl_easy_perform(curl);
        if( res == 0 )
        {
                res = curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&lcurl_info_response);
        }
        else
        {
                curl_easy_cleanup(curl);
                printf("\n The error code is: %d \n",res);
                printf("\n The error msg is: %s \n", ac_error);
                return FAIL;
        }
//////////////////////////////////////////////////////////////////////////////////
    The description
//////////////////////////////////////////////////////////////////////////////////
                Enviroment: OS:RHEL_4 Libcurl version; 7.16.4 Result:OK

                The DEBUG information:
set http form params
== Info: About to connect() to client.webshots.com port 80
== Info: Trying 216.239.116.34... == Info: connected
== Info: Connected to client.webshots.com (216.239.116.34) port 80
=> Send header, 228 bytes (0xe4)
0000: POST /partners/partner.fcgi? HTTP/1.1
0027: Host: client.webshots.com
0042: Pragma: no-cache
0054: Accept: */*
0061: Content-Length: 484
0076: Expect: 100-continue
008c: Content-Type: multipart/form-data; boundary=--------------------
00cc: --------e4db07edfcf5
00e2:
<= Recv header, 23 bytes (0x17)
0000: HTTP/1.1 100 Continue
<= Recv header, 22 bytes (0x16)
0000: Server: Resin/3.0.23
<= Recv header, 19 bytes (0x13)
0000: Content-Length: 0
<= Recv header, 37 bytes (0x25)
0000: Date: Wed, 25 Jul 2007 03:49:19 GMT
=> Send data, 484 bytes (0x1e4)
0000: ------------------------------e4db07edfcf5
002c: Content-Disposition: form-data; name="username"
005d:
005f: xxxxxxx(I mask this,the follow is same)
006b: ------------------------------e4db07edfcf5
0097: Content-Disposition: form-data; name="password"
00c8:
00ca: xxxxxxx
00ec: ------------------------------e4db07edfcf5
0118: Content-Disposition: form-data; name="partner"
0148:
014a: xxxxxxxx
0152: ------------------------------e4db07edfcf5
017e: Content-Disposition: form-data; name="action"
01ad:
01af: login
01b6: ------------------------------e4db07edfcf5--
<= Recv header, 17 bytes (0x11)
0000: HTTP/1.1 200 OK
<= Recv header, 22 bytes (0x16)
0000: Server: Resin/3.0.23
<= Recv header, 26 bytes (0x1a)
0000: Content-Type: text/plain
<= Recv header, 28 bytes (0x1c)
0000: Transfer-Encoding: chunked
<= Recv header, 37 bytes (0x25)
0000: Date: Wed, 25 Jul 2007 03:49:22 GMT
<= Recv data, 93 bytes (0x5d)
0000: 0050
0006: success=1.errormessage=.memberUrl=http://community.webshots.com/
0046: user/shiyou2007.
0058: 0
005b:
== Info: Connection #0 to host client.webshots.com left intact
== Info: Closing connection #0

Login OK

//////////////////////////////////////////////////////////////////////////////////
                Enviroment: OS:Fedora 7 Libcurl version; 7.16.4 Result:Fail

                The DEBUG information:
..................(The same as previous one)
017e: Content-Disposition: form-data; name="action"
01ad:
01af: login
01b6: ------------------------------aa09fe24b25c--
<= Recv header, 17 bytes (0x11)
0000: HTTP/1.1 200 OK
<= Recv header, 22 bytes (0x16)
0000: Server: Resin/3.0.23
<= Recv header, 26 bytes (0x1a)
0000: Content-Type: text/plain
<= Recv header, 28 bytes (0x1c)
0000: Transfer-Encoding: chunked
<= Recv header, 37 bytes (0x25)
0000: Date: Wed, 25 Jul 2007 03:30:38 GMT
<= Recv header, 2 bytes (0x2)
0000:
== Info: transfer closed with outstanding read data remaining
== Info: Closing connection #0

 The error code is: 18

 The error msg is: transfer closed with outstanding read data remaining

Login Fail!

//////////////////////////////////////////////////////////////////////////////////
                Enviroment: OS:Redhat 9 Libcurl version; 7.16.4 Result:Fail

                The DEBUG information:
 set http form params
== Info: About to connect() to client.webshots.com:80
== Info: Connected to c13-ws-upload-lb.cnet.com (216.239.116.34) port 80
=> Send header, 219 bytes (0xdb)
0000: POST /partners/partner.fcgi? HTTP/1.1
0027: Host: client.webshots.com
0042: Pragma: no-cache
0054: Accept: */*
0061: Content-Length: 439
0076: Expect: 100-continue
008c: Content-Type: multipart/form-data; boundary=curlU9NZqQr0gxra2rS5
00cc: mfYYQnYlpxN
00d9:
<= Recv header, 23 bytes (0x17)
0000: HTTP/1.1 100 Continue
段错误(Segment fault)
////////////////////////////////////////////////////////////////////////////////////

        What's the problem? How can i fix it?

        Thanks for your help! ^_^

        aaron shi
        shiyou_at_nextbase.cn
          2007-07-25
Received on 2007-07-25