cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl_easy_perform connection termination scenario

From: Pankaj Takawale <pankaj.takawale_at_gmail.com>
Date: Thu, 10 Mar 2011 18:56:06 -0500

I noticed following behaviour of curl_easy_perform when server
terminates connection after sending response to curl client.

Case1: curl_easy_perform returns immediately, and detects broken
connection at the time of next request.
        It then re-establishes the connection and retrieve page successfully.
Whole process takes around 220ms (200ms for TCP connection + SSL
Handshake, 8 ms for http response)

Case2: curl_easy_perform is taking around 900ms to sec to return.
        In this case too, I see server returned response followed by TCP FIN
immediately.
        All termination packet flow is same as of case1.
        Still curl_easy_perform is taking 800ms further to return.

Please advice any work around to deal with this.

Case2 flow: 900ms return from curel_easy_perform, actually server
returns response immediately in 8ms.
        
Req 2245 11:01:12.121 203.243.24.23 172.206.36.76
TLSv1 Application Data
           2246 11:01:12.122 203.243.24.23 172.206.36.76
TLSv1 [TCP Out-Of-Order] Application Data
Resp 2247 11:01:12.128 172.206.36.76 203.243.24.23
TLSv1 Application Data
           2248 11:01:12.128 172.206.36.76 203.243.24.23 TCP
    https > 57468 [FIN, ACK] Seq=106247 Ack=22273 Win=26652 Len=0
           2249 11:01:12.128 172.206.36.76 203.243.24.23
TLSv1 [TCP Out-Of-Order] Application Data
           2250 11:01:12.128 172.206.36.76 203.243.24.23 TCP
    https > 57468 [FIN, ACK] Seq=106247 Ack=22273 Win=26652 Len=0
           2251 11:01:12.128 203.243.24.23 172.206.36.76 TCP
    57468 > https [ACK] Seq=22273 Ack=106247 Win=64128 Len=0
           2252 11:01:12.128 203.243.24.23 172.206.36.76 TCP
    [TCP Dup ACK 2251#1] 57468 > https [ACK] Seq=22273 Ack=106247
Win=64128 Len=0
           2253 11:01:12.129 203.243.24.23 172.206.36.76
TLSv1 Encrypted Alert
           2254 11:01:12.129 203.243.24.23 172.206.36.76
TLSv1 [TCP Out-Of-Order] Encrypted Alert
           2255 11:01:12.130 203.243.24.23 172.206.36.76 TCP
    57468 > https [FIN, ACK] Seq=22302 Ack=106248 Win=64128 Len=0
           2256 11:01:12.130 203.243.24.23 172.206.36.76 TCP
    57468 > https [FIN, ACK] Seq=22302 Ack=106248 Win=64128 Len=0
           2257 11:01:12.133 172.206.36.76 203.243.24.23 TCP
    https > 57468 [RST, ACK] Seq=106248 Ack=22302 Win=26681 Len=0
           2258 11:01:12.133 172.206.36.76 203.243.24.23 TCP
    https > 57468 [RST, ACK] Seq=106248 Ack=22302 Win=26681 Len=0
        
        
Case1 flow: Immediate return by curl_easy_perform

Req 3513 11:01:52.923 203.243.24.23 172.206.36.76
TLSv1 Application Data
           3514 11:01:52.923 203.243.24.23 172.206.36.76
TLSv1 [TCP Out-Of-Order] Application Data
Resp 3515 11:01:52.929 172.206.36.76 203.243.24.23
TLSv1 Application Data
           3516 11:01:52.929 172.206.36.76 203.243.24.23 TCP
    https > 57482 [FIN, ACK] Seq=106247 Ack=22273 Win=26652 Len=0
           3517 11:01:52.929 172.206.36.76 203.243.24.23
TLSv1 [TCP Out-Of-Order] Application Data
           3518 11:01:52.929 172.206.36.76 203.243.24.23 TCP
    https > 57482 [FIN, ACK] Seq=106247 Ack=22273 Win=26652 Len=0
           3519 11:01:52.929 203.243.24.23 172.206.36.76 TCP
    57482 > https [ACK] Seq=22273 Ack=106247 Win=64128 Len=0
           3520 11:01:52.929 203.243.24.23 172.206.36.76
TLSv1 Encrypted Alert
           3521 11:01:52.929 203.243.24.23 172.206.36.76 TCP
    57482 > https [ACK] Seq=22273 Ack=106247 Win=64128 Len=0
           3522 11:01:52.930 203.243.24.23 172.206.36.76
TLSv1 [TCP Out-Of-Order] Encrypted Alert
           3523 11:01:52.931 203.243.24.23 172.206.36.76 TCP
    57482 > https [FIN, ACK] Seq=22302 Ack=106248 Win=64128 Len=0
           3524 11:01:52.931 203.243.24.23 172.206.36.76 TCP
    57482 > https [FIN, ACK] Seq=22302 Ack=106248 Win=64128 Len=0
           3525 11:01:52.934 172.206.36.76 203.243.24.23 TCP
    https > 57482 [RST, ACK] Seq=106248 Ack=22302 Win=26681 Len=0
           3526 11:01:52.934 172.206.36.76 203.243.24.23 TCP
    https > 57482 [RST, ACK] Seq=106248 Ack=22302 Win=26681 Len=0
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-11