]> granicus.if.org Git - curl/commitdiff
Venkat Akella found out that libcurl did not like HTTP responses that simply
authorDaniel Stenberg <daniel@haxx.se>
Sat, 25 Nov 2006 13:32:04 +0000 (13:32 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 25 Nov 2006 13:32:04 +0000 (13:32 +0000)
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.

61 files changed:
CHANGES
RELEASE-NOTES
lib/transfer.c
tests/data/test11
tests/data/test150
tests/data/test153
tests/data/test155
tests/data/test159
tests/data/test163
tests/data/test166
tests/data/test167
tests/data/test168
tests/data/test173
tests/data/test174
tests/data/test175
tests/data/test176
tests/data/test186
tests/data/test187
tests/data/test233
tests/data/test234
tests/data/test239
tests/data/test243
tests/data/test257
tests/data/test26
tests/data/test264
tests/data/test267
tests/data/test27
tests/data/test273
tests/data/test276
tests/data/test277
tests/data/test278
tests/data/test279
tests/data/test28
tests/data/test281
tests/data/test282 [new file with mode: 0644]
tests/data/test43
tests/data/test44
tests/data/test45
tests/data/test515
tests/data/test516
tests/data/test56
tests/data/test59
tests/data/test62
tests/data/test63
tests/data/test64
tests/data/test67
tests/data/test69
tests/data/test71
tests/data/test73
tests/data/test79
tests/data/test80
tests/data/test81
tests/data/test83
tests/data/test84
tests/data/test85
tests/data/test89
tests/data/test9
tests/data/test90
tests/data/test91
tests/data/test95
tests/server/sws.c

diff --git a/CHANGES b/CHANGES
index 080ffed0bf72bd3d3bcee1883fe3f1d3d4f6b9de..c19e62b96d263dadd3e44052b24cd3a39553c2ca 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,19 @@
 
                                   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.
 
index 31fb48e3cf7f891e1797c3a31d3dda48c6bae64e..5bccf5cde04e31de3a9713df01eb32ca8f560f86 100644 (file)
@@ -23,6 +23,8 @@ This release includes the following bugfixes:
  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:
 
@@ -38,6 +40,6 @@ This release would not have looked like this without help, code, reports and
 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)
index 2d5d0dfe8c260b2808206e824e7e05f2bcc8f874..6b7b819781b2d8007a9c999d0659d790341910bf 100644 (file)
@@ -501,9 +501,19 @@ CURLcode Curl_readwrite(struct connectdata *conn,
                   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:
index e34a36646624b45eb8ce7b1824f2cde8baa2f9b0..84baa9076019503299e162e5c8b8eb503fe382ed 100644 (file)
@@ -21,6 +21,7 @@ This server reply is for testing a simple Location: following
 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
 
@@ -35,6 +36,7 @@ Connection: close
 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
 
index 7ae812d93d5bd469baa8d7df836150abac1fce60..60e6b912d47fefd64a95fe2da495edaecbf27993 100644 (file)
@@ -21,6 +21,7 @@ This is not the real page either!
 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>
@@ -35,6 +36,7 @@ WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4Ab
 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>
index 1fd54a1f90b6a3fcdadd1bec4185b28a03adc446..51137b38f96fd60e65cb98c32f4dac608f57eca0 100644 (file)
@@ -6,6 +6,7 @@ HTTP/1.1 401 Authorization Required swsclose
 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>
@@ -95,6 +96,7 @@ HTTP/1.1 401 Authorization Required swsclose
 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
index 91ed13abd04eb51f745bde4f228bdd853c7e4559..871b0267ae5dbc66dbb7dc8382d171afcbb458ed 100644 (file)
@@ -33,6 +33,7 @@ This is not the real page either!
 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>
@@ -55,6 +56,7 @@ WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4Ab
 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>
index 2fcd7d502ea759ca33202eba56248055d0831b15..8513c3073944e3e672e74c61542cb44b67defac3 100644 (file)
@@ -21,6 +21,7 @@ This is not the real page either!
 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>
@@ -35,6 +36,7 @@ WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4Ab
 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>
index c51adfccbe5590995b9c78da96ef3b028a8f55b6..b87504e440814f68459b69a98a5b556bd2369400 100644 (file)
@@ -4,6 +4,7 @@
 HTTP/1.1 200 OK swsclose
 Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake
+Content-Length: 10
 
 blablabla
 </data>
index edc184abf07fef16136735dfb8caec9e2706b566..0e915f9e02eb9e85315df3d9b1687b616464356a 100644 (file)
@@ -4,6 +4,7 @@
 HTTP/1.1 200 OK swsclose
 Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake
+Content-Length: 10
 
 blablabla
 </data>
index a23d94ba7a698deb13b4597f81615541ad29e086..6fa5b1bd34ca6dda664d01ef56287db8c08ec241 100644 (file)
@@ -9,6 +9,7 @@ WWW-Authenticate: Digest realm="weirdorealm", nonce="12345"
 <data1000>
 HTTP/1.1 200 OK swsclose\r
 Server: no
+Content-Length: 15
 \r
 Nice auth sir!
 </data1000>
@@ -19,6 +20,7 @@ WWW-Authenticate: Digest realm="weirdorealm", nonce="12345"
 \r
 HTTP/1.1 200 OK swsclose\r
 Server: no
+Content-Length: 15
 \r
 Nice auth sir!
 </datacheck>
index dbaf667c942112635fc9bbdfb1c52accf6af889f..6f93ebab8097731114eb8b79854b821e9d9c03b8 100644 (file)
@@ -20,6 +20,7 @@ you should ignore this data too
 <data1001>
 HTTP/1.1 200 OK swsclose\r
 Server: no
+Content-Length: 15
 \r
 Nice auth sir!
 </data1001>
@@ -33,6 +34,7 @@ WWW-Authenticate: Digest realm="realmweirdo", nonce="123456"
 \r
 HTTP/1.1 200 OK swsclose\r
 Server: no
+Content-Length: 15
 \r
 Nice auth sir!
 </datacheck>
index 130fa9e075c94abe35a2840722d0a20ce5a813f8..0050e5cccbe452b289d007037ff6aee599ab34a1 100644 (file)
@@ -4,6 +4,7 @@
 HTTP/1.1 200 OK swsclose
 Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake
+Content-Length: 11
 
 blablabla
 
index 32130f1be2fa0c950a9e59d03bb00a5821b8d618..b14d39b1cee2f1c6dd4bee814484412fc44f5365 100644 (file)
@@ -5,6 +5,7 @@ HTTP/1.1 200 beng swsclose
 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>
index 3a979af983680d170647d9bee52665d64a67e090..db8f8a88a516d28f87470224c5160b759de533dd 100644 (file)
@@ -13,6 +13,7 @@ This is not the real page
 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>
@@ -26,6 +27,7 @@ Content-Type: text/html; charset=iso-8859-1
 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>
index e7ed3ecbb0b23edf45b8c56bfa21d4b28188864a..f197367d70127ca38ed767f6cd9992fca8c4594c 100644 (file)
@@ -14,6 +14,7 @@ Content-Type: text/html; charset=iso-8859-1
 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>
@@ -27,6 +28,7 @@ Content-Type: text/html; charset=iso-8859-1
 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>
index e878bca80951d1e37b4a5da632c75bd4c099b4f4..763c6c805c7e880706fb5d38d84dfb6ea405ed05 100644 (file)
@@ -4,6 +4,7 @@
 HTTP/1.1 200 OK swsclose
 Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake
+Content-Length: 11
 
 blablabla
 
index 67aace5d1db7023c59a95f4c0c8522b3fea6e2bb..2919164f5d5cf5daff533e7ed0b8e2cb5edb9945 100644 (file)
@@ -14,6 +14,7 @@ This server reply is for testing a simple Location: following
 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
 
@@ -28,6 +29,7 @@ Connection: close
 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
 
index ca19364be00da275a80807ebc3d3d53611a6a4a4..b11aabbbd29bd6fdc487aa57c33efe77a86eeeb1 100644 (file)
@@ -28,6 +28,7 @@ Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake swsclose
 Content-Type: text/html
 Funny-head: yesyes
+Content-Length: 9
 
 contents
 </data2>
@@ -47,6 +48,7 @@ Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake swsclose
 Content-Type: text/html
 Funny-head: yesyes
+Content-Length: 9
 
 contents
 </datacheck>
index 9c7d8c14ec962bc14091a3d3822065eaabd33c5b..c8775c543809900adb1056f4bafa393e2a706ce3 100644 (file)
@@ -19,6 +19,7 @@ Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake swsclose
 Content-Type: text/html
 Funny-head: yesyes
+Content-Length: 9
 
 contents
 </data2>
@@ -38,6 +39,7 @@ Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake swsclose
 Content-Type: text/html
 Funny-head: yesyes
+Content-Length: 9
 
 contents
 </datacheck>
index 7a789b600cae4e7c59336f2401f7380505699358..77e7ae2965550b3cdc5b0044592af2ea1c86b22c 100644 (file)
@@ -16,7 +16,7 @@ Hey you, authenticate or go away!
 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>
@@ -29,7 +29,7 @@ Content-Length: 34
 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>
index f8ef686e7236855f026ca8fca23f05e4d24bcd21..614dfc0fe6c53809e6a375fae0698748cb6daab8 100644 (file)
@@ -36,7 +36,7 @@ Hey you, authenticate or go away!
 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>
@@ -57,7 +57,7 @@ Content-Length: 34
 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>
index 5c81409cfabcb34e5c3f09bd8902cf1ee47e4e26..90680f39513c8c24e2021328c001f27020a92d4f 100644 (file)
@@ -31,6 +31,7 @@ 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
 
@@ -50,6 +51,7 @@ Location: http://athird.com/2570003
 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
 
index 01b1bd7f3bf0b088627fdb7e0d0302bdb5505490..f92cf2326dd6ec6eb594644fe4203968d65a6eac 100644 (file)
@@ -7,7 +7,7 @@ HTTP GET
 # Server-side
 <reply>
 <data>
-HTTP/1.1 200 Mooo swsclose
+HTTP/1.0 200 Mooo swsclose
 Server: test-server/fake
 Connection: close
 
index 23bd99aa4fec105ca85fdc2324408a1f9efe4b80..55f79b6d23c549e8e1b66a398e38a50bb0b407ba 100644 (file)
@@ -12,6 +12,7 @@ HTTP proxy Basic auth
 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>
index 56d2a0a67287731ad4b9c97962220a0555299b5c..c379d486504bc018be670a30879f57d85644d0c9 100644 (file)
@@ -28,6 +28,7 @@ This is not the real page either!
 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>
@@ -42,6 +43,7 @@ WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4Ab
 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>
index 60a474aef83fd6aa4054bc9f223cfb2dad13de20..85b087aab7c84ff467909948881651de183e3a7e 100644 (file)
@@ -11,6 +11,7 @@ cookies
 HTTP/1.1 200 Mooo swsclose
 Connection: close
 Set-Cookie: path=/; thewinneris=nowayyouwin;
+Content-Length: 8
 
 *flopp*
 </data>
index dbc8f8429c7fbd1c282e40cd7034d8bbe77a734c..6aabfdcbd381f2213195b873c1f6a16aea73b40b 100644 (file)
@@ -23,6 +23,7 @@ This is not the real page
 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>
@@ -37,6 +38,7 @@ Content-Type: text/html; charset=iso-8859-1
 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>
index 7090ec581abb8941a8d6ff65e455ecd207683dea..aa56090f47d4cf8e85be559489fadf34ec73cc3e 100644 (file)
@@ -21,6 +21,7 @@ This server reply is for testing a simple Location: following
 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
 
@@ -35,6 +36,7 @@ Connection: close
 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
 
index 1828203be2e84ed4d8dc5bb88e33342500b48707..f19e3423d667bb9ffc665ea887e05ef0c745d07c 100644 (file)
@@ -10,6 +10,7 @@ HTTP FORMPOST
 HTTP/1.1 200 OK swsclose
 Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake
+Content-Length: 11
 
 blablabla
 
index 77e80456a5788d7b03b619c3257aa28d3b583bd0..795b090ce6868df6637543ead73a991819909efd 100644 (file)
@@ -12,6 +12,7 @@ HTTP proxy Basic auth
 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
index 716a99ea64c378a961698c011bbdd4714e47aad4..2483e39d29aa2719526d1d8b67337be0760fa4a3 100644 (file)
@@ -12,6 +12,7 @@ HTTP proxy Basic auth
 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
index 355924fa61ba4787b32c646aa43e185c401200e1..98d19c59d91b26c5ed0e93f7e75793c4567d9c9d 100644 (file)
@@ -20,6 +20,7 @@ This server reply is for testing a simple Location: following
 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
 
@@ -34,6 +35,7 @@ Connection: close
 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
 
index ffbebbe66d3faa30fe83c810be1a82dfad219704..f228d2d0b0b1e4ce80bcd12948c4f8cc32778ba9 100644 (file)
@@ -50,7 +50,7 @@ Weird
 </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
diff --git a/tests/data/test282 b/tests/data/test282
new file mode 100644 (file)
index 0000000..b15745b
--- /dev/null
@@ -0,0 +1,43 @@
+<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>
index 1ee0e2f89bb506714b7e22d12bdd7546bf19e429..fe6c54e18c7ab276db4576750800ff58248db59f 100644 (file)
@@ -22,6 +22,7 @@ This server reply is for testing a simple Location: following
 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
 
@@ -36,6 +37,7 @@ Connection: close
 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
 
index ab66d11c00a221bd5421ca35d7b4d7a272364460..beea1cf6eada11ac7a1670d03d96e75378001542 100644 (file)
@@ -8,7 +8,7 @@ HTTP replaced headers
 # 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
 
index b8d76201d0921298242ee2bf7b35c78a88adf21e..b8d96f7e6855736f22f07d173d42f4ced7ef04a9 100644 (file)
@@ -21,6 +21,7 @@ This server reply is for testing a simple Location: following
 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
 
@@ -35,6 +36,7 @@ Connection: close
 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
 
index 566da84f402c2a3266779e4c69bb754ae0d1ce10..c2dd48fe8444b3bef7b17cf9eb597e6854c66e12 100644 (file)
@@ -5,6 +5,7 @@
 HTTP/1.1 200 OK swsclose
 Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake
+Content-Length: 3
 
 OK
 </data>
@@ -36,7 +37,7 @@ http://%HOSTIP:%HTTPPORT/515
 </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
index cd45b3115ce52c4213c9dc6a62808ca8e0d7de32..3a8210f224839f7df26684aed21e3dbbdff30dc3 100644 (file)
@@ -5,6 +5,7 @@
 HTTP/1.1 200 OK swsclose
 Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake
+Content-Length: 3
 
 OK
 </data>
@@ -36,7 +37,7 @@ http://%HOSTIP:%HTTPPORT/516
 </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
index d4f369907b34406a788e1d90c36b761205435d0d..d84b86ddcbc2525def575ce8a01461148884eb87 100644 (file)
@@ -9,7 +9,7 @@ chunked Transfer-Encoding
 # 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
index 5e0e694fae19de7006288408ec5d57b951620e06..7ea59af86cb879063b4d5b973fa3d17d9bc359db 100644 (file)
@@ -8,7 +8,7 @@ HTTP GET
 # 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
 
index 48eca088e114bea32b8299091310d4834d9b1cff..fd08f7e5f1796c9005594df1e2eb54978ebb5675 100644 (file)
@@ -8,7 +8,7 @@ HTTP replaced headers
 # 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
index bcd5a188a9cee15a6e7ac937b0a6777f8e0077f3..179b9e6b89403dd62f468bf4137911d94fef1925 100644 (file)
@@ -12,6 +12,7 @@ HTTP proxy Basic auth
 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>
index 9521102c70fa3ad66f6373d4babb0f69f1ba5091..e2ba87dcdd778c4afa68a26daa2450890818e6c3 100644 (file)
@@ -12,6 +12,7 @@ HTTP/1.1 401 Authorization Required swsclose
 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>
@@ -22,6 +23,7 @@ This is not the real page
 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>
@@ -31,10 +33,12 @@ HTTP/1.1 401 Authorization Required swsclose
 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>
index da43a7d3ab1a9b2f6e022c34ebc49a6c317e84be..19aeeec9bfc0d4ec491932685c14b22a96a4d2ec 100644 (file)
@@ -28,6 +28,7 @@ This is not the real page either!
 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>
@@ -42,6 +43,7 @@ WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4Ab
 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>
index 333ec2c0fd8550e38fb87919bb3b49e7d1c3944e..7102342a92771bcb086c052129f4daf2f76c14a7 100644 (file)
@@ -14,6 +14,7 @@ WWW-Authenticate: Basic
 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>
@@ -36,6 +37,7 @@ This is not the real page either!
 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>
@@ -47,6 +49,7 @@ WWW-Authenticate: Basic
 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
@@ -57,6 +60,7 @@ WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4Ab
 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>
index 733db358c9e6bb97540ba343d41c2a69c2a5bf0a..baedaab893d4f01aa588a4602eed894065cd8bb0 100644 (file)
@@ -10,6 +10,7 @@ HTTP FORMPOST
 HTTP/1.1 200 OK swsclose
 Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake
+Content-Length: 11
 
 blablabla
 
index 516784e05678336b3ef3793b8b4229827d179506..6e612eec63d280db54c2dd07f90faf13c422e55c 100644 (file)
@@ -12,6 +12,7 @@ HTTP/1.1 200 OK swsclose
 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>
index 6d080bd5d77f234180066497fc4ad5db2c6b832b..8954360f09077d8f50b932167419475514c5a128 100644 (file)
@@ -10,7 +10,7 @@ HTTP proxy
 # 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
index dcf153dd73c62b64ddcf04364318ca7084e11452..41656810b48a467263999950c8e8edada458929b 100644 (file)
@@ -16,6 +16,7 @@ Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake swsclose
 Content-Type: text/html
 Funny-head: yesyes
+Content-Length: 9
 
 contents
 </data>
@@ -27,6 +28,7 @@ Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake swsclose
 Content-Type: text/html
 Funny-head: yesyes
+Content-Length: 9
 
 contents
 </datacheck>
index 732f9dc6d0ac45f43906ce8dd9ecc136b8d479ed..eabd9fff754475fc66beb1fcb76fde2c8c81321c 100644 (file)
@@ -26,6 +26,7 @@ This is not the real page either!
 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>
@@ -40,6 +41,7 @@ Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4
 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>
index d68a042be9a2f924c5d970e810c644a307b1ada7..7c176969f45d6eb472ca40e860fac9da884713a0 100644 (file)
@@ -16,6 +16,7 @@ Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake swsclose
 Content-Type: text/html
 Funny-head: yesyes
+Content-Length: 9
 
 contents
 </data>
@@ -27,6 +28,7 @@ Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake swsclose
 Content-Type: text/html
 Funny-head: yesyes
+Content-Length: 9
 
 contents
 </datacheck>
index 387d0e08e6072e9cfe554e3a5e363ac6b3293710..9d5e678b69cd5cb04aed3707ffa250d3857df1b7 100644 (file)
@@ -10,7 +10,7 @@ HTTP proxy
 # 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
index 50629e0dae6006019c7f73aa0750223ff7fbc70c..a82110769cede08eefc12d93dda494378fdbdeb1 100644 (file)
@@ -15,6 +15,7 @@ Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake swsclose
 Content-Type: text/html
 Funny-head: yesyes
+Content-Length: 9
 
 contents
 </data>
index 3ed2439db1337ac8d5e1104c7a55d9115b9d9e33..40b3074f42dbcf4f3d9dc7a3d1797798c438627f 100644 (file)
@@ -50,6 +50,7 @@ This is not the real page either!
 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>
@@ -75,6 +76,7 @@ WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4Ab
 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>
index 7476278ec6e5eadf101d47934170b83b849b8c42..034a605175c2f6b8172083a34d113f3c7b03c0a4 100644 (file)
@@ -8,7 +8,7 @@ HTTP file upload
 # 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
 
index df1bb69430057930896438c6df987f7b1e8fea50..70e77645ea0d0c3628fa84331963a7fcdd9d7323 100644 (file)
@@ -17,6 +17,7 @@ WWW-Authenticate: Basic
 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>
@@ -51,6 +52,7 @@ WWW-Authenticate: Basic
 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>
@@ -71,6 +73,7 @@ This is not the real page either!
 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>
@@ -82,6 +85,7 @@ WWW-Authenticate: Basic
 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
@@ -100,6 +104,7 @@ WWW-Authenticate: Basic
 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
@@ -110,6 +115,7 @@ WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4Ab
 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>
index ad054592643c1eb0d18438f40db0ca53c3dcf98c..ae64b16ef3e8344d4fd13e2fb7d282cde62e0e53 100644 (file)
@@ -37,6 +37,7 @@ This is not the real page either!
 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>
@@ -60,6 +61,7 @@ WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAAAGgoEAc51AYVDgyNcAAAAAAAAAAG4Ab
 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>
index 5a5aebcd384e2e41512f96b51c4c3a359e9ecec3..d2cd2c4299c61a85498c8861ea32b6f312a5665d 100644 (file)
@@ -14,6 +14,7 @@ Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake swsclose
 Content-Type: text/html
 Funny-head: yesyes
+Content-Length: 9
 
 contents
 </data>
@@ -25,6 +26,7 @@ Date: Thu, 09 Nov 2010 14:49:00 GMT
 Server: test-server/fake swsclose
 Content-Type: text/html
 Funny-head: yesyes
+Content-Length: 9
 
 contents
 </datacheck>
index 9e63e507cd6afcbc62f66de1b5fed406e9ceedfc..a2d81c709aabf6ef9f986c7583bb942bc86d3a87 100644 (file)
@@ -572,6 +572,9 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
   req->open = FALSE;
 
   if(req->testno < 0) {
+    size_t msglen;
+    char msgbuf[64];
+
     switch(req->testno) {
     case DOCNUMBER_QUIT:
       logmsg("Replying to QUIT");
@@ -580,8 +583,10 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
     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: