cURL / Mailing Lists / curl-users / Single Mail

curl-users

Curl exit when reply doesn't contain content-length

From: Luigi Grilli <luigi.grilli_at_elmo.it>
Date: Tue, 8 May 2007 11:37:22 +0200

I'm using libcurl (and surely curl itself for testing) to connect to a
GoAhead web server that is an embedded web server.
I'm using:
curl 7.16.2 (i686-pc-mingw32) libcurl/7.16.2
Protocols: tftp ftp telnet dict ldap http file
Features: Largefile

Also tried with curl 7.16.1, same issue!

I'm also using basic authentication.

When I try to connect to the server through our company proxy (using -x
host:port option of curl) I receive correctly all reply from the
webserver, so NO problems with proxy.

The problems comes when I direct connect to the webserver.
If the webserver return a content-length header curl works perfectly.
If the server doesn't return the content-length curl exit without
waiting for the response body.
Reading some past mails of this list I read the expected behaviour was
for HTTP1.0 to wait for the webserver to close the connection. This is
how other clients that works with this webserver get the reply content
(and expect the server to close the connection). Anyway the server on
the reply put HTTP1.1. I think that this makes curl confusing and closes
the connection.

I tried also with the --ignore-content-length option but it went event
worst.

Thanks
Luigi

Ps. The following is the curl output for the request that closes
prematurely. I had to remove the real page address.

== Info: About to connect() to 172.16.3.88 port 80 (#0)
== Info: Trying 172.16.3.88... == Info: connected
== Info: Connected to 172.16.3.88 (172.16.3.88) port 80 (#0)
== Info: Server auth using Basic with user 'root'
=> Send header, 206 bytes (0xce)
0000: 47 45 54 3 GET
/xxxxxx/xxx
                                                            48 54 54
xxxxxxxxxxx HTT
0040: 50 2f 31 2e 31 0d 0a 41 75 74 68 6f 72 69 7a 61 P/1.1..Authoriza
0050: 74 69 6f 6e 3a 20 42 61 73 69 63 20 63 6d 39 76 tion: Basic cm9v
0060: 64 44 70 6c 62 47 31 76 4d 6a 41 77 4e 67 3d 3d dDplbG1vMjAwNg==
0070: 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a 20 63 75 ..User-Agent: cu
0080: 72 6c 2f 37 2e 31 36 2e 32 20 28 69 36 38 36 2d rl/7.16.2 (i686-
0090: 70 63 2d 6d 69 6e 67 77 33 32 29 20 6c 69 62 63 pc-mingw32) libc
00a0: 75 72 6c 2f 37 2e 31 36 2e 32 0d 0a 48 6f 73 74 url/7.16.2..Host
00b0: 3a 20 31 37 32 2e 31 36 2e 33 2e 38 38 0d 0a 41 : 172.16.3.88..A
00c0: 63 63 65 70 74 3a 20 2a 2f 2a 0d 0a 0d 0a ccept: */*....
<= Recv header, 17 bytes (0x11)
0000: 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d HTTP/1.1 200 OK.
0010: 0a .
<= Recv header, 32 bytes (0x20)
0000: 44 61 74 65 3a 20 54 75 65 20 4d 61 79 20 20 38 Date: Tue May 8
0010: 20 31 31 3a 31 36 3a 34 36 20 32 30 30 37 0d 0a 11:16:46 2007..
<= Recv header, 22 bytes (0x16)
0000: 53 65 72 76 65 72 3a 20 47 6f 41 68 65 61 64 2d Server: GoAhead-
0010: 57 65 62 73 0d 0a Webs..
<= Recv header, 18 bytes (0x12)
0000: 50 72 61 67 6d 61 3a 20 6e 6f 2d 63 61 63 68 65 Pragma: no-cache
0010: 0d 0a ..
<= Recv header, 25 bytes (0x19)
0000: 43 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 6e Cache-Control: n
0010: 6f 2d 63 61 63 68 65 0d 0a o-cache..
<= Recv header, 25 bytes (0x19)
0000: 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 Content-Type: te
0010: 78 74 2f 68 74 6d 6c 0d 0a xt/html..
<= Recv header, 2 bytes (0x2)
0000: 0d 0a ..
== Info: Connection #0 to host 172.16.3.88 left intact
== Info: Closing connection #0
Received on 2007-05-08