Changelog
+Daniel (25 November 2006)
+- Venkat Akella found out that libcurl did not like HTTP responses that simply
+ responded with a single status line and no headers nor body. Starting now, a
+ HTTP response on a persistent connection (i.e not set to be closed after the
+ response has been taken care of) must have Content-Length or chunked
+ encoding set, or libcurl will simply assume that there is no body.
+
+ To my horror I learned that we had no less than 57(!) test cases that did bad
+ HTTP responses like this, and even the test http server (sws) responded badly
+ when queried by the test system if it is the test system. So although the
+ actual fix for the problem was tiny, going through all the newly failing test
+ cases got really painful and boring.
+
Daniel (24 November 2006)
- James Housley did lots of work and introduced SFTP downloads.
o SIGSEGV when disconnecting on a transfer on a re-used handle when the
host name didn't resolve
o stack overwrite on 64bit Windows in the chunked decoding department
+ o HTTP responses on persistent connections without Content-Length nor chunked
+ encoding are now considered to be without response body
Other curl-related news:
advice from friends like these:
James Housley, Olaf Stueben, Yang Tse, Gisle Vanem, Bradford Bruce,
- Ciprian Badescu, Dmitriy Sergeyev, Nir Soffer
+ Ciprian Badescu, Dmitriy Sergeyev, Nir Soffer, Venkat Akella
Thanks! (and sorry if I forgot to mention someone)
k->keepon |= KEEP_WRITE;
}
}
- else
+ else {
k->header = FALSE; /* no more header to parse! */
+ if((k->size == -1) && !conn->bits.chunk && !conn->bits.close)
+ /* When connection is not to get closed, but no
+ Content-Length nor Content-Encoding chunked have been
+ received, there is no body in this response. We don't set
+ stop_reading TRUE since that would also prevent necessary
+ authentication actions to take place. */
+ conn->bits.no_body = TRUE;
+
+ }
+
if (417 == k->httpcode) {
/*
* we got: "417 Expectation Failed" this means:
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</data1002>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</datacheck>
Server: Apache/1.3.27 (Darwin) PHP/4.1.2\r
WWW-Authenticate: Digest realm="testrealm", nonce="1053604145"\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 26\r
\r
This is not the real page
</data1>
Server: Apache/1.3.27 (Darwin) PHP/4.1.2\r
WWW-Authenticate: Digest realm="testrealm", nonce="1053604145"\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 26\r
\r
HTTP/1.1 200 OK\r
Server: Apache/1.3.27 (Darwin) PHP/4.1.2\r
HTTP/1.1 200 Type-3 Recevied and all Things are fine swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</data1002>
HTTP/1.1 200 Type-3 Recevied and all Things are fine swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</datacheck>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</data1002>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</datacheck>
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 10
blablabla
</data>
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 10
blablabla
</data>
<data1000>
HTTP/1.1 200 OK swsclose\r
Server: no
+Content-Length: 15
\r
Nice auth sir!
</data1000>
\r
HTTP/1.1 200 OK swsclose\r
Server: no
+Content-Length: 15
\r
Nice auth sir!
</datacheck>
<data1001>
HTTP/1.1 200 OK swsclose\r
Server: no
+Content-Length: 15
\r
Nice auth sir!
</data1001>
\r
HTTP/1.1 200 OK swsclose\r
Server: no
+Content-Length: 15
\r
Nice auth sir!
</datacheck>
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 11
blablabla
Server: Microsoft-IIS/6.0\r
Authentication-Info: Passport1.4 tname=MSPAuth,tname=MSPProf,tname=MSPConsent,tname=MSPSecAuth\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 26
\r
This is not the real page
</data>
HTTP/1.1 200 moo swsclose\r
Server: Microsoft-IIS/6.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 16
\r
content for you
</data1>
HTTP/1.1 200 moo swsclose\r
Server: Microsoft-IIS/6.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 16
\r
content for you
</datacheck>
HTTP/1.1 200 moo swsclose\r
Server: Microsoft-IIS/6.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 16
\r
content for you
</data>
HTTP/1.1 200 moo swsclose\r
Server: Microsoft-IIS/6.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 16
\r
content for you
</datacheck>
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 11
blablabla
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
+Content-Length: 9
contents
</data2>
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
+Content-Length: 9
contents
</datacheck>
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
+Content-Length: 9
contents
</data2>
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
+Content-Length: 9
contents
</datacheck>
HTTP/1.1 200 Things are fine in proxy land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
-Content-Length; 42\r
+Content-Length: 42\r
\r
Contents of that page you requested, sir.
</data1002>
HTTP/1.1 200 Things are fine in proxy land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
-Content-Length; 42\r
+Content-Length: 42\r
\r
Contents of that page you requested, sir.
</datacheck>
HTTP/1.1 200 Things are fine in proxy land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
-Content-Length; 42\r
+Content-Length: 42\r
\r
Contents of that page you requested, sir.
</data1002>
HTTP/1.1 200 Things are fine in proxy land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
-Content-Length; 42\r
+Content-Length: 42\r
\r
Contents of that page you requested, sir.
</datacheck>
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
# Server-side
<reply>
<data>
-HTTP/1.1 200 Mooo swsclose
+HTTP/1.0 200 Mooo swsclose
Server: test-server/fake
Connection: close
HTTP/1.1 200 OK swsclose\r
Date: Thu, 09 Nov 2010 14:49:00 GMT\r
Content-Type: text/html\r
+Content-Length: 26\r
\r
the content would go here
</data>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</data1002>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</datacheck>
HTTP/1.1 200 Mooo swsclose
Connection: close
Set-Cookie: path=/; thewinneris=nowayyouwin;
+Content-Length: 8
*flopp*
</data>
HTTP/1.1 200 OK swsclose\r
Server: Apache/1.3.27 (Darwin) PHP/4.1.2\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 23\r
\r
This IS the real page!
</data1000>
HTTP/1.1 200 OK swsclose\r
Server: Apache/1.3.27 (Darwin) PHP/4.1.2\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 23\r
\r
This IS the real page!
</datacheck>
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 11
blablabla
HTTP/1.1 200 OK swsclose\r
Date: Thu, 09 Nov 2010 14:49:00 GMT\r
Content-Type: text/html\r
+Content-Length: 27\r
\r
the content would go here\r
</data>\r
HTTP/1.1 200 OK swsclose\r
Date: Thu, 09 Nov 2010 14:49:00 GMT\r
Content-Type: text/html\r
+Content-Length: 27\r
\r
the content would go here\r
</data>\r
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
</strip>
<protocol>
PUT /we/want/281 HTTP/1.1\r
-Host: 127.0.0.1:%HTTPPORT\r
+Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
Content-Length: 38\r
Expect: 100-continue\r
--- /dev/null
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data>
+HTTP/1.1 200 OK
+
+</data>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+ <name>
+HTTP GET with no response body or headers
+ </name>
+ <command>
+http://%HOSTIP:%HTTPPORT/282
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<protocol>
+GET /282 HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+Accept: */*\r
+\r
+</protocol>
+</verify>
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
# Server-side
<reply>
<data>
-HTTP/1.1 200 OK swsclose
+HTTP/1.0 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
HTTP/1.1 200 Followed here fine swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 52
If this is received, the location following worked
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 3
OK
</data>
</strip>
<protocol>
POST /515 HTTP/1.1\r
-Host: 127.0.0.1:%HTTPPORT\r
+Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
Content-Length: 0\r
Content-Type: application/x-www-form-urlencoded\r
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 3
OK
</data>
</strip>
<protocol>
POST /516 HTTP/1.1\r
-Host: 127.0.0.1:%HTTPPORT\r
+Host: %HOSTIP:%HTTPPORT\r
Accept: */*\r
Content-Length: 0\r
\r
# Server-side
<reply>
<data>
-HTTP/1.1 200 OK swsclose
+HTTP/1.0 200 OK swsclose
Funny-head: yesyes
This is the proof it works
# Server-side
<reply name="1">
<data>
-HTTP/1.1 200 OK swsclose
+HTTP/1.0 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
# Server-side
<reply>
<data>
-HTTP/1.1 200 OK swsclose\r
+HTTP/1.0 200 OK swsclose\r
Date: Thu, 09 Nov 2010 14:49:00 GMT\r
Content-Type: text/html\r
\r
HTTP/1.1 200 OK swsclose\r
Date: Thu, 09 Nov 2010 14:49:00 GMT\r
Content-Type: text/html\r
+Content-Length: 26
\r
the content would go here
</data>
Server: Apache/1.3.27 (Darwin) PHP/4.1.2\r
WWW-Authenticate: Digest realm="testrealm", nonce="1053604145"\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 26\r
\r
This is not the real page
</data>
HTTP/1.1 200 OK swsclose\r
Server: Apache/1.3.27 (Darwin) PHP/4.1.2\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 23\r
\r
This IS the real page!
</data1000>
Server: Apache/1.3.27 (Darwin) PHP/4.1.2\r
WWW-Authenticate: Digest realm="testrealm", nonce="1053604145"\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 26\r
\r
HTTP/1.1 200 OK swsclose\r
Server: Apache/1.3.27 (Darwin) PHP/4.1.2\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 23\r
\r
This IS the real page!
</datacheck>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</data1002>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</datacheck>
WWW-Authenticate: Wild-and-crazy\r
WWW-Authenticate: NTLM\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 26\r
\r
This is not the real page
</data>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</data1002>
WWW-Authenticate: Wild-and-crazy\r
WWW-Authenticate: NTLM\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 26\r
\r
HTTP/1.1 401 Now gimme that second request of crap\r
Server: Microsoft-IIS/5.0\r
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</datacheck>
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
+Content-Length: 11
blablabla
Date: Thu, 09 Nov 2010 14:49:00 GMT\r
Content-Type: text/html\r
Set-Cookie: IPCZQX01af0fca5c=000010008168c200d25dfc4b; path=/; domain=.NOT_DISCLOSED.se\r
+Content-Length: 4\r
\r
boo
</data>
# Server-side
<reply>
<data>
-HTTP/1.1 200 OK
+HTTP/1.0 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Content-Type: text/html
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
+Content-Length: 9
contents
</data>
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
+Content-Length: 9
contents
</datacheck>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</data1002>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</datacheck>
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
+Content-Length: 9
contents
</data>
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
+Content-Length: 9
contents
</datacheck>
# Server-side
<reply>
<data>
-HTTP/1.1 200 OK
+HTTP/1.0 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Content-Type: text/html
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
+Content-Length: 9
contents
</data>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</data1012>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</datacheck>
# Server-side
<reply>
<data>
-HTTP/1.1 200 OK swsclose
+HTTP/1.0 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
WWW-Authenticate: Wild-and-crazy\r
WWW-Authenticate: NTLM\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 26\r
\r
This is not the real page
</data>
WWW-Authenticate: Wild-and-crazy\r
WWW-Authenticate: NTLM\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 26\r
\r
This is not the real page
</data10>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</data1012>
WWW-Authenticate: Wild-and-crazy\r
WWW-Authenticate: NTLM\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 26\r
\r
HTTP/1.1 401 Now gimme that second request of crap\r
Server: Microsoft-IIS/5.0\r
WWW-Authenticate: Wild-and-crazy\r
WWW-Authenticate: NTLM\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 26\r
\r
HTTP/1.1 401 Now gimme that second round of crap\r
Server: Microsoft-IIS/5.0\r
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</datacheck>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</data1002>
HTTP/1.1 200 Things are fine in server land swsclose\r
Server: Microsoft-IIS/5.0\r
Content-Type: text/html; charset=iso-8859-1\r
+Content-Length: 32\r
\r
Finally, this is the real page!
</datacheck>
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
+Content-Length: 9
contents
</data>
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
+Content-Length: 9
contents
</datacheck>
req->open = FALSE;
if(req->testno < 0) {
+ size_t msglen;
+ char msgbuf[64];
+
switch(req->testno) {
case DOCNUMBER_QUIT:
logmsg("Replying to QUIT");
case DOCNUMBER_WERULEZ:
/* we got a "friends?" question, reply back that we sure are */
logmsg("Identifying ourselves as friends");
- sprintf(weare, "HTTP/1.1 200 OK\r\n\r\nWE ROOLZ: %d\r\n",
- (int)getpid());
+ sprintf(msgbuf, "WE ROOLZ: %d\r\n", (int)getpid());
+ msglen = strlen(msgbuf);
+ sprintf(weare, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\n\r\n%s",
+ msglen, msgbuf);
buffer = weare;
break;
case DOCNUMBER_INTERNAL: