cURL / Mailing Lists / curl-users / Single Mail

curl-users

Slow connect time when doing a file upload.

From: Barry Leslie <Barry.Leslie_at_primebase.com>
Date: Tue, 02 Mar 2010 15:08:19 -0800

Hi,

When using curl or libcurl to upload a file there seems to be a 2 second
pause after connecting before the upload starts.

I am using curl 7.16.3 on OS X 10.5.8 PPC.

If I do :
curl --upload-file afile "http://osx:8080/test"

It will take 2+ seconds, the size of the file doesn't matter.

If I do:
curl -d "xxxx" "http://osx:8080/test"

It completes immediately.

I have looked at the network using tcpdump and there seems to be a 2 second
pause before it starts to send the data. Here is the tcpdump output from:

sudo tcpdump -ttt -ni lo0 port 8080

========================================
000000 IP6 ::1.49614 > ::1.8080: S 3866292607:3866292607(0) win 65535 <mss
16324,nop,wscale 2,nop,nop,timestamp 749334800 0,sackOK,eol>
000133 IP6 ::1.8080 > ::1.49614: R 0:0(0) ack 3866292608 win 0
000321 IP 127.0.0.1.49615 > 127.0.0.1.8080: S 2844298682:2844298682(0) win
65535 <mss 16344,nop,wscale 3,nop,nop,timestamp 749334800 0,sackOK,eol>
000113 IP 127.0.0.1.8080 > 127.0.0.1.49615: S 739242953:739242953(0) ack
2844298683 win 65535 <mss 16344,nop,wscale 3,nop,nop,timestamp 749334800
749334800,sackOK,eol>
000018 IP 127.0.0.1.49615 > 127.0.0.1.8080: . ack 1 win 65535
<nop,nop,timestamp 749334800 749334800>
000019 IP 127.0.0.1.8080 > 127.0.0.1.49615: . ack 1 win 65535
<nop,nop,timestamp 749334800 749334800>
001888 IP 127.0.0.1.49615 > 127.0.0.1.8080: P 1:197(196) ack 1 win 65535
<nop,nop,timestamp 749334800 749334800>
000056 IP 127.0.0.1.8080 > 127.0.0.1.49615: . ack 197 win 65535
<nop,nop,timestamp 749334800 749334800>

!!!! 2 second wait !!!
2. 018910 IP 127.0.0.1.49615 > 127.0.0.1.8080: . 197:16529(16332) ack 1 win
65535 <nop,nop,timestamp 749334820 749334800>

000002 IP 127.0.0.1.49615 > 127.0.0.1.8080: P 16529:16581(52) ack 1 win
65535 <nop,nop,timestamp 749334820 749334800>
000128 IP 127.0.0.1.8080 > 127.0.0.1.49615: . ack 16581 win 65321
<nop,nop,timestamp 749334820 749334820>
002297 IP 127.0.0.1.49615 > 127.0.0.1.8080: . 16581:32913(16332) ack 1 win
65535 <nop,nop,timestamp 749334820 749334820>
000003 IP 127.0.0.1.49615 > 127.0.0.1.8080: P 32913:32965(52) ack 1 win
65535 <nop,nop,timestamp 749334820 749334820>

========================================

From a profile sample I took it looks like it is waiting in
CURL_socket_ready().

Can anybody explain this to me?

It only seems to have this problem when using file input.

Barry

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-03-03