From fdab0be1c0c0de6226bb31abf7766d4bde05a792 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johan=20Sundstr=C3=B6m?= <oyasumi@gmail.com>
Date: Sat, 11 Mar 2000 22:05:46 +0100
Subject: [PATCH] Treat the most hideous concievable input in an as gentle,
 forgiving and polite manor as we possibly could -- something, which I
 formerly used to think of as solely the web server's role in the
 negotiation...

Rev: lib/modules/Protocols.pmod/HTTP.pmod/Query.pike:1.14
---
 lib/modules/Protocols.pmod/HTTP.pmod/Query.pike | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
index a9ed037d34..cdf766093e 100644
--- a/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
+++ b/lib/modules/Protocols.pmod/HTTP.pmod/Query.pike
@@ -535,8 +535,14 @@ string data()
       l=len-strlen(buf)+datapos;
    if (l>0 && con)
    {
-      string s=con->read(l);
-      buf+=s;
+     if(headers->server == "WebSTAR")
+     { // Some servers reporting this name exhibit some really hideous behaviour:
+       buf += con->read(); // First, they may well lie about the content-length
+       if(buf[datapos..datapos+1] == "\r\n")
+	 datapos += 2; // And, as if that wasn't enough! *mumble*
+     }
+     else
+       buf += con->read(l);
    }
    // note! this can't handle keep-alive � HEAD requests.
    return buf[datapos..];
-- 
GitLab