cURL / Mailing Lists / curl-library / Single Mail

curl-library

Test 206 hanging with reduced sws write chunks

From: Fabian Keil <freebsd-listen_at_fabiankeil.de>
Date: Wed, 21 Nov 2012 16:54:50 +0100

I noticed that test 206 hangs when reducing the chunk size used by sws:

diff --git a/tests/server/sws.c b/tests/server/sws.c
index 2910274..1b04d0f 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -1112,8 +1112,8 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
        larger chunks are split up so that the client will need to do multiple
        recv() calls to get it and thus we exercise that code better */
     size_t num = count;
- if(num > 200)
- num = 200;
+ if(num > 20)
+ num = 20;
     written = swrite(sock, buffer, num);
     if (written < 0) {
       sendfailure = TRUE;

fk@r500 ~/git/curl $src/.libs/curl --include --trace-ascii - --trace-time http://test.remote.haxx.se:206/path/2060002 --proxy http://127.0.0.1:8990 --proxy-user silly:person --proxy-digest --proxytunnel
13:51:51.849042 == Info: About to connect() to proxy 127.0.0.1 port 8990 (#0)
13:51:51.849968 == Info: Trying 127.0.0.1...
13:51:51.850365 == Info: connected
13:51:51.850433 == Info: Connected to 127.0.0.1 (127.0.0.1) port 8990 (#0)
13:51:51.850465 == Info: Establish HTTP proxy tunnel to test.remote.haxx.se:206
13:51:51.850501 == Info: Proxy auth using Digest with user 'silly'
13:51:51.850626 => Send header, 134 bytes (0x86)
0000: CONNECT test.remote.haxx.se:206 HTTP/1.1
002a: Host: test.remote.haxx.se:206
0049: User-Agent: curl/7.28.2-DEV
0066: Proxy-Connection: Keep-Alive
0084:
13:51:51.850754 == Info: Easy mode waiting response from proxy CONNECT
13:51:51.852924 <= Recv header, 57 bytes (0x39)
0000: HTTP/1.1 407 Authorization Required to proxy me my dear
HTTP/1.1 407 Authorization Required to proxy me my dear
13:51:51.854114 <= Recv header, 63 bytes (0x3f)
0000: Proxy-Authenticate: Digest realm="weirdorealm", nonce="12345"
Proxy-Authenticate: Digest realm="weirdorealm", nonce="12345"
13:51:51.854475 <= Recv header, 2 bytes (0x2)
0000:

13:51:51.854757 == Info: TUNNEL_STATE switched to: 0
13:51:51.854871 == Info: Establish HTTP proxy tunnel to test.remote.haxx.se:206
13:51:51.855150 == Info: Proxy auth using Digest with user 'silly'
13:51:51.855367 => Send header, 292 bytes (0x124)
0000: CONNECT test.remote.haxx.se:206 HTTP/1.1
002a: Host: test.remote.haxx.se:206
0049: Proxy-Authorization: Digest username="silly", realm="weirdorealm
0089: ", nonce="12345", uri="test.remote.haxx.se:206", response="676e0
00c9: 836f3e1c5b31bf29770ef9d8224"
00e7: User-Agent: curl/7.28.2-DEV
0104: Proxy-Connection: Keep-Alive
0122:
13:51:51.856329 == Info: Easy mode waiting response from proxy CONNECT
13:51:51.857111 <= Recv header, 27 bytes (0x1b)
0000: HTTP/1.1 200 OK swsbounce
HTTP/1.1 200 OK swsbounce
13:51:51.857796 <= Recv header, 11 bytes (0xb)
0000: Server: no.
Server: no
13:51:51.858073 <= Recv header, 2 bytes (0x2)
0000:

13:51:51.858343 == Info: Proxy replied OK to CONNECT request
13:51:51.858532 => Send header, 103 bytes (0x67)
0000: GET /path/2060002 HTTP/1.1
001c: User-Agent: curl/7.28.2-DEV
0039: Host: test.remote.haxx.se:206
0058: Accept: */*
0065:
13:51:51.859195 <= Recv data, 21 bytes (0x15)
0000: Nice proxy auth sir!.
13:51:51.859465 == Info: Increasing bytecount by 21 from hbuflen
Nice proxy auth sir!
13:51:51.860040 <= Recv data, 20 bytes (0x14)
0000: HTTP/1.1 200 OK.Date
HTTP/1.1 200 OK
Date13:51:51.860381 <= Recv data, 40 bytes (0x28)
0000: : Thu, 09 Nov 2010 14:49:00 GMT.Content-
: Thu, 09 Nov 2010 14:49:00 GMT
Content-13:51:51.860603 <= Recv data, 20 bytes (0x14)
0000: Length: 7.Connection
Length: 7
Connection13:51:51.860734 <= Recv data, 20 bytes (0x14)
0000: : close.Content-Type
: close
Content-Type13:51:51.860884 <= Recv data, 20 bytes (0x14)
0000: : text/html.Funny-he
: text/html
Funny-he13:51:51.861240 <= Recv data, 19 bytes (0x13)
0000: ad: yesyes..daniel.
ad: yesyes

daniel
[curl keeps running]

After spending some time looking for a curl bug I now believe
that the test is flawed and relies on bug #39 and the responses
being read with the headers.

With the attached patches test 206 seems to work reliably again.

I'm not sure about the second patch as I'm under the impression
that 407 responses to CONNECT requests shouldn't have bodies
either, but the text of the body seems to imply that they do
in the real world?

Fabian

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2012-11-21