File 10850.patch of Package squid-beta

---------------------
PatchSet 10850 
Date: 2007/06/17 21:48:20
Author: hno
Branch: HEAD
Tag: (none) 
Log:
Author: Christos Tsantilas <chtsanti@users.sourceforge.net>
HTTP/0.9 responses support

This patch adds back HTTP/0.9 support, upgrading them to HTTP/1.0.

Members: 
	src/http.cc:1.523->1.524 

Index: squid3/src/http.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/http.cc,v
retrieving revision 1.523
retrieving revision 1.524
diff -u -r1.523 -r1.524
--- squid3/src/http.cc	29 May 2007 13:31:40 -0000	1.523
+++ squid3/src/http.cc	17 Jun 2007 21:48:20 -0000	1.524
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.523 2007/05/29 13:31:40 amosjeffries Exp $
+ * $Id: http.cc,v 1.524 2007/06/17 21:48:20 hno Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -717,30 +717,42 @@
 
     const bool parsed = newrep->parse(readBuf, eof, &error);
 
-    if (!parsed && error > 0) { // unrecoverable parsing error
-        debugs(11, 3, "processReplyHeader: Non-HTTP-compliant header: '" <<  readBuf->content() << "'");
-        flags.headers_parsed = 1;
-        // negated result yields http_status
-        failReply (newrep, error);
-        ctx_exit(ctx);
-        return;
-    }
-
-    if (!parsed) { // need more data
-        assert(!error);
-        assert(!eof);
-        delete newrep;
-        ctx_exit(ctx);
-        return;
+    if(!parsed && readBuf->contentSize() > 5 && strncmp(readBuf->content(), "HTTP/", 5) != 0){
+	 MemBuf *mb;
+	 HttpReply *tmprep = new HttpReply;
+	 tmprep->sline.version = HttpVersion(1, 0);
+	 tmprep->sline.status = HTTP_OK;
+	 tmprep->header.putTime(HDR_DATE, squid_curtime);
+	 tmprep->header.putExt("X-Transformed-From", "HTTP/0.9");
+	 mb = tmprep->pack();
+	 newrep->parse(mb, eof, &error);
+	 delete tmprep;
+    }
+    else{
+	 if (!parsed && error > 0) { // unrecoverable parsing error
+	      debugs(11, 3, "processReplyHeader: Non-HTTP-compliant header: '" <<  readBuf->content() << "'");
+	      flags.headers_parsed = 1;
+	      // negated result yields http_status
+	      failReply (newrep, error);
+	      ctx_exit(ctx);
+	      return;
+	 }
+	 
+	 if (!parsed) { // need more data
+	      assert(!error);
+	      assert(!eof);
+	      delete newrep;
+	      ctx_exit(ctx);
+	      return;
+	 }
+	 
+	 debugs(11, 9, "GOT HTTP REPLY HDR:\n---------\n" << readBuf->content() << "\n----------");
+	 
+	 header_bytes_read = headersEnd(readBuf->content(), readBuf->contentSize());
+	 readBuf->consume(header_bytes_read);
     }
 
     reply = HTTPMSGLOCK(newrep);
-
-    debugs(11, 9, "GOT HTTP REPLY HDR:\n---------\n" << readBuf->content() << "\n----------");
-
-    header_bytes_read = headersEnd(readBuf->content(), readBuf->contentSize());
-    readBuf->consume(header_bytes_read);
-
     flags.headers_parsed = 1;
 
     keepaliveAccounting(reply);