]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Forward port of all the header parsing cleanup of 2.5.STABLE8:
authorserassio <>
Sun, 6 Mar 2005 21:46:24 +0000 (21:46 +0000)
committerserassio <>
Sun, 6 Mar 2005 21:46:24 +0000 (21:46 +0000)
- squid-2.5.STABLE7-header_parsing.patch
- Bug #1228
- Bug #1242
- Relaxed_header_parser squid.conf option.
- New ERR_INVALID_RESP error message.

34 files changed:
errors/Bulgarian/ERR_INVALID_RESP [new file with mode: 0755]
errors/Catalan/ERR_INVALID_RESP [new file with mode: 0755]
errors/Czech/ERR_INVALID_RESP [new file with mode: 0755]
errors/Danish/ERR_INVALID_RESP [new file with mode: 0755]
errors/Dutch/ERR_INVALID_RESP [new file with mode: 0755]
errors/English/ERR_INVALID_RESP [new file with mode: 0755]
errors/Estonian/ERR_INVALID_RESP [new file with mode: 0755]
errors/Finnish/ERR_INVALID_RESP [new file with mode: 0755]
errors/French/ERR_INVALID_RESP [new file with mode: 0755]
errors/German/ERR_INVALID_RESP [new file with mode: 0755]
errors/Hebrew/ERR_INVALID_RESP [new file with mode: 0755]
errors/Hungarian/ERR_INVALID_RESP [new file with mode: 0755]
errors/Italian/ERR_INVALID_RESP [new file with mode: 0755]
errors/Japanese/ERR_INVALID_RESP [new file with mode: 0755]
errors/Korean/ERR_INVALID_RESP [new file with mode: 0755]
errors/Lithuanian/ERR_INVALID_RESP [new file with mode: 0755]
errors/Polish/ERR_INVALID_RESP [new file with mode: 0755]
errors/Portuguese/ERR_INVALID_RESP [new file with mode: 0755]
errors/Romanian/ERR_INVALID_RESP [new file with mode: 0755]
errors/Russian-1251/ERR_INVALID_RESP [new file with mode: 0755]
errors/Russian-koi8-r/ERR_INVALID_RESP [new file with mode: 0755]
errors/Serbian/ERR_INVALID_RESP [new file with mode: 0755]
errors/Simplify_Chinese/ERR_INVALID_RESP [new file with mode: 0755]
errors/Slovak/ERR_INVALID_RESP [new file with mode: 0755]
errors/Spanish/ERR_INVALID_RESP [new file with mode: 0755]
errors/Swedish/ERR_INVALID_RESP [new file with mode: 0755]
errors/Traditional_Chinese/ERR_INVALID_RESP [new file with mode: 0755]
errors/Turkish/ERR_INVALID_RESP [new file with mode: 0755]
src/HttpHeader.cc
src/cache_cf.cc
src/enums.h
src/http.cc
src/mime.cc
src/structs.h

diff --git a/errors/Bulgarian/ERR_INVALID_RESP b/errors/Bulgarian/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Catalan/ERR_INVALID_RESP b/errors/Catalan/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Czech/ERR_INVALID_RESP b/errors/Czech/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..d3a1307
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2">
+<TITLE>CHYBA: Pozadovany dokument je nedostupny</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>Po¾adovaný dokument je nedostupný</H2>
+<HR noshade size="1px">
+<P>
+Pøi provádìní po¾adavku:
+<PRE>
+%R
+</PRE>
+<P>
+se objevila následující chyba:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+HTTP odpovìï obdr¾ená od vzdáleného serveru je nesrozumitelná èi po¹kozená.
+Kontaktujte prosím správce vzdáleného serveru. Dal¹í informace Vám poskytne
+správce tohoto proxy serveru <A HREF="mailto:%w">%w</A>
diff --git a/errors/Danish/ERR_INVALID_RESP b/errors/Danish/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Dutch/ERR_INVALID_RESP b/errors/Dutch/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/English/ERR_INVALID_RESP b/errors/English/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Estonian/ERR_INVALID_RESP b/errors/Estonian/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..6c746c3
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>VIGA: Soovitud URLi ei õnnestu laadida</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>VIGA</H1>
+<H2>Soovitud URLi ei õnnestu laadida</H2>
+<HR noshade size="1px">
+<P>
+Üritades käsitleda järgnevat päringut:
+<PRE>
+%R
+</PRE>
+<P>
+Tekkis viga:
+<UL>
+<LI>
+<STRONG>
+Vigane vastus
+</STRONG>
+</UL>
+
+<P>
+Vasti võetud HTTP vastus on tundmatu või muidu katki. Palun kontakteeruge
+saidi operaatoriga. Teie vehemälu serveri administraator võib saada anda
+täiendavat infot selle vea detailide kohta.
+
+<P>Teie vehemälu serveri administraator on <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Finnish/ERR_INVALID_RESP b/errors/Finnish/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..e3c70d8
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>VIRHE: Pyydetty&auml; osoitetta ei voitu hakea</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>VIRHE</H1>
+<H2>Pyydetty&auml; osoitetta ei voitu hakea</H2>
+<HR noshade size="1px">
+<P>
+Yritett&auml;ess&auml; toimittaa pyynt&ouml;&auml;:
+<PRE>
+%R
+</PRE>
+<P>
+Tapahtui seuraava virhe:
+<UL>
+<LI>
+<STRONG>
+Virheellinen vastaus
+</STRONG>
+</UL>
+
+<P>
+Palvelimen l&auml;hett&auml;m&auml;&auml; HTTP-vastausta ei ymm&auml;rretty tai se oli
+v&auml;&auml;r&auml;n muotoinen. Ota yhteytt&auml; palvelimen yll&auml;pit&auml;j&auml;&auml;n.
+V&auml;lipalvelimesi yll&auml;pit&auml;j&auml;lt&auml; voit saada lis&auml;tietoja
+ongelman luonteesta.
+<P>V&auml;lityspalvelintasi yll&auml;pit&auml;&auml; <A HREF="mailto:%w">%w</A>.
diff --git a/errors/French/ERR_INVALID_RESP b/errors/French/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/German/ERR_INVALID_RESP b/errors/German/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..74bd383
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>FEHLER: Der angeforderte URL konnte nicht geholt werden</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>FEHLER</H1>
+<H2>Der angeforderte URL konnte nicht geholt werden</H2>
+<HR noshade size="1px">
+<P>
+W&auml;hrend des Versuches, die Anfrage
+<PRE>
+%R
+</PRE>
+<P>
+zu verarbeiten, trat der folgende Fehler auf:
+<UL>
+<LI>
+<STRONG>
+Ung&uuml;ltige Antwort
+</STRONG>
+</UL>
+
+<P>
+Die HTTP Antwortmeldung des kontaktierten Servers konnte nicht verstanden werden
+oder war auf andere Weise missgebildet. Bitte kontaktieren Sie den Betreiber der
+betreffenden Webseite. Wenn n&ouml;tig kann Ihr Cache Administrator in der Lage sein,
+Sie mit mehr Details &uuml;ber die genaue Ursache des Problems zu versorgen.
+
+<P>Ihr Cache Administrator ist <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Hebrew/ERR_INVALID_RESP b/errors/Hebrew/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Hungarian/ERR_INVALID_RESP b/errors/Hungarian/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Italian/ERR_INVALID_RESP b/errors/Italian/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..fd50ad1
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERRORE: La URL richiesta non pu&ograve; essere recuperata</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERRORE</H1>
+<H2>La URL richiesta non pu&ograve; essere recuperata</H2>
+<HR noshade size="1px">
+<P>
+Mentre si elaborava la richiesta:
+<PRE>
+%R
+</PRE>
+<P>
+&Egrave; avvenuto il seguente errore:
+<UL>
+<LI>
+<STRONG>
+Risposta non valida
+</STRONG>
+</UL>
+
+<P>
+Il messaggio contenente la risposta HTTP ricevuto dal server che si sta
+contattando non pu&ograve; essere interpretato od &egrave; stato in qualche modo alterato.
+Si prega di contattare un operatore del sito. Se necessario, l'amministratore della vostra
+cache potr&agrave; fornirvi maggiori dettagli sull'esatta natura del problema.
+
+<P>L'amministratore della vostra cache &egrave; <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Japanese/ERR_INVALID_RESP b/errors/Japanese/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Korean/ERR_INVALID_RESP b/errors/Korean/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Lithuanian/ERR_INVALID_RESP b/errors/Lithuanian/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..053154f
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1257">
+<TITLE>KLAIDA: Puslapis nurodytu adresu negali bûti atsiøstas</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>KLAIDA</H1>
+<H2>Puslapis nurodytu adresu negali bûti atsiøstas</H2>
+<HR noshade size="1px">
+<P>
+Bandant ávykdyti uþklausà:
+<PRE>
+%R
+</PRE>
+<P>
+Gautas klaidos praneðimas:
+<UL>
+<LI>
+<STRONG>
+Klaidingas atsakymas
+</STRONG>
+</UL>
+
+<P>
+Ið serverio gautas nesuprantamas HTTP atsakymas arba jis buvo klaidingai
+suformuotas. Susisiekite su serverio operatoriumi. Jûsø proxy serverio
+administratorius gali suteikti jums daugiau informacijos apie ðià problemà.
+</P>
diff --git a/errors/Polish/ERR_INVALID_RESP b/errors/Polish/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Portuguese/ERR_INVALID_RESP b/errors/Portuguese/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Romanian/ERR_INVALID_RESP b/errors/Romanian/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Russian-1251/ERR_INVALID_RESP b/errors/Russian-1251/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Russian-koi8-r/ERR_INVALID_RESP b/errors/Russian-koi8-r/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..080b718
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=koi8-r">
+<TITLE>ïûéâëá: úÁÐÒÏÛÅÎÎÙÊ URL ÎÅ ÍÏÖÅÔ ÂÙÔØ ÄÏÓÔÁ×ÌÅÎ</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ïûéâëá</H1>
+<H2>úÁÐÒÏÛÅÎÎÙÊ URL ÎÅ ÍÏÖÅÔ ÂÙÔØ ÄÏÓÔÁ×ÌÅÎ.</H2>
+<HR noshade size="1px">
+<P>
+÷Ï ×ÒÅÍÑ ÏÂÒÁÂÏÔËÉ ÚÁÐÒÏÓÁ:
+<PRE>
+%R
+</PRE>
+<P>
+ðÒÏÉÚÏÛÌÁ ÓÌÅÄÕÀÝÁÑ ÏÛÉÂËÁ:
+<UL>
+<LI>
+<STRONG>
+îÅ×ÅÒÎÙÊ ÚÁÐÒÏÓ.
+</STRONG>
+</UL>
+
+<P>
+HTTP ÏÔ×ÅÔ, ÐÏÌÕÞÅÎÎÙÊ ÏÔ ÚÁÐÒÁÛÉ×ÁÅÍÏÇÏ ÓÅÒ×ÅÒÁ ÎÅÐÏÎÑÔÅΠÉÌÉ 
+ÉÚÕÒÏÄÏ×ÁÎ. ïÂÒÁÝÁÊÔÅÓØ Ë ÁÄÍÉÎÉÓÔÒÁÔÏÒÁÍ ÚÁÐÒÁÛÉ×ÁÅÍÏÇÏ ÓÁÊÔÁ.
+áÄÍÉÎÉÓÔÒÁÔÏÒ ×ÁÛÅÇÏ ÐÒÏËÓÉ-ÓÅÒ×ÅÒÁ ÍÏÖÅÔ ÐÒÉ ÎÅÏÂÈÏÄÉÍÏÓÔÉ 
+ÂÏÌÅÅ ÄÅÔÁÌØÎÏ ÏÐÉÓÁÔØ  ÓÕÝÅÓÔ×Ï ÐÒÏÂÌÅÍÙ.
+
+<P>
+áÄÒÅÓ áÄÍÉÎÉÓÔÒÁÔÏÒÁ ×ÁÛÅÇÏ ÐÒÏËÓÉ-ÓÅÒ×ÅÒÁ: <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Serbian/ERR_INVALID_RESP b/errors/Serbian/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Simplify_Chinese/ERR_INVALID_RESP b/errors/Simplify_Chinese/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Slovak/ERR_INVALID_RESP b/errors/Slovak/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..7dbb2b1
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2">
+<TITLE>CHYBA: Pozadovany dokument je nedostupny</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>CHYBA</H1>
+<H2>Po¾adovaný dokument je nedostupný</H2>
+<HR noshade size="1px">
+<P>
+Pri pokuse o prístup k:
+<PRE>
+%R
+</PRE>
+<P>
+do¹lo k nasledovnej chybe:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+HTTP odpovedi obdr¾anej z kontaktovaného servera nebolo mo¾né porozumie»
+alebo bola nejako po¹kodená. Kontaktujte prosím správcu servera. V prípade
+potreby Vám Vá¹ cache administrátor mô¾e poskytnú» detaily o presnej povahe
+problému.
+</P>
+
+<P>Va¹ím cache administrátorom je <A HREF="mailto:%w">%w</A>.</P>
diff --git a/errors/Spanish/ERR_INVALID_RESP b/errors/Spanish/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Swedish/ERR_INVALID_RESP b/errors/Swedish/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..629e371
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD>
+<TITLE>Fel: Beg&auml;rd URL kunde inte h&auml;mtas</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff; font-family:verdana,sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>FEL</H1>
+<H2>Beg&auml;rd URL kunde inte h&auml;mtas</H2>
+<HR noshade size="1px">
+<P>
+Vid f&ouml;rs&ouml;ket att h&auml;mta URL:
+<A HREF="%U">%U</A>
+<P>
+Mottogs f&ouml;ljande fel:
+<UL>
+<LI>
+<STRONG>
+Felaktigt svarsmeddelande
+</STRONG>
+</UL>
+
+<P>
+HTTP svarsmeddelandet ifr&aring;n den kontaktade servern &auml;r felaktigt och
+kunde inte tolkas. V&auml;nligen kontakta den ansvariga f&ouml;r webbservern ifr&aring;ga.
+Din cacheserver administrat&ouml;r man eventuellt ge dig mera information om
+det specifika problemet med denna sida.
+</P>
+
+<P>Din cacheserver administrat&ouml;r &auml;r <A HREF="mailto:%w">%w</A>. 
+</P>
+
diff --git a/errors/Traditional_Chinese/ERR_INVALID_RESP b/errors/Traditional_Chinese/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
diff --git a/errors/Turkish/ERR_INVALID_RESP b/errors/Turkish/ERR_INVALID_RESP
new file mode 100755 (executable)
index 0000000..960968c
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
+<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
+</HEAD><BODY>
+<H1>ERROR</H1>
+<H2>The requested URL could not be retrieved</H2>
+<HR noshade size="1px">
+<P>
+While trying to process the request:
+<PRE>
+%R
+</PRE>
+<P>
+The following error was encountered:
+<UL>
+<LI>
+<STRONG>
+Invalid Response
+</STRONG>
+</UL>
+
+<P>
+The HTTP Response message received from the contacted server
+could not be understood or was otherwise malformed. Please contact
+the site operator. Your cache administrator may be able to provide
+you with more details about the exact nature of the problem if needed.
+
+<P>Your cache administrator is <A HREF="mailto:%w">%w</A>. 
index 464d07c55e21626b355b6a5e1ed06cca8ad38562..718b18de42615acd801f2a0f8b0116a061f1726d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpHeader.cc,v 1.101 2004/12/20 16:30:32 robertc Exp $
+ * $Id: HttpHeader.cc,v 1.102 2005/03/06 14:46:29 serassio Exp $
  *
  * DEBUG: section 55    HTTP Header
  * AUTHOR: Alex Rousskov
@@ -467,59 +467,115 @@ httpHeaderReset(HttpHeader * hdr)
 int
 httpHeaderParse(HttpHeader * hdr, const char *header_start, const char *header_end)
 {
-    const char *field_start = header_start;
-    HttpHeaderEntry *e;
+    const char *field_ptr = header_start;
+    HttpHeaderEntry *e, *e2;
 
     assert(hdr);
     assert(header_start && header_end);
     debug(55, 7) ("parsing hdr: (%p)\n%s\n", hdr, getStringPrefix(header_start, header_end));
     HttpHeaderStats[hdr->owner].parsedCount++;
-    /* commonn format headers are "<name>:[ws]<value>" lines delimited by <CRLF> */
 
-    while (field_start < header_end) {
+    if (memchr(header_start, '\0', header_end - header_start)) {
+        debug(55, 1) ("WARNING: HTTP header contains NULL characters {%s}\n",
+                      getStringPrefix(header_start, header_end));
+        return httpHeaderReset(hdr);
+    }
+
+    /* common format headers are "<name>:[ws]<value>" lines delimited by <CRLF>.
+     * continuation lines start with a (single) space or tab */
+    while (field_ptr < header_end) {
+        const char *field_start = field_ptr;
         const char *field_end;
-        const char *field_ptr = field_start;
 
         do {
-            field_end = field_ptr = field_ptr + strcspn(field_ptr, "\r\n");
-            /* skip CRLF */
-
-            if (*field_ptr == '\r')
-                field_ptr++;
-
-            if (*field_ptr == '\n')
-                field_ptr++;
-        } while (*field_ptr == ' ' || *field_ptr == '\t');
-
-        if (!*field_end || field_end > header_end)
-            return httpHeaderReset(hdr);       /* missing <CRLF> */
+            const char *this_line = field_ptr;
+            field_ptr = (const char *)memchr(field_ptr, '\n', header_end - field_ptr);
+
+            if (!field_ptr)
+                return httpHeaderReset(hdr);   /* missing <LF> */
+
+            field_end = field_ptr;
+
+            field_ptr++;       /* Move to next line */
+
+            if (field_end > this_line && field_end[-1] == '\r') {
+                field_end--;   /* Ignore CR LF */
+                /* Ignore CR CR LF in relaxed mode */
+
+                if (Config.onoff.relaxed_header_parser && field_end > this_line + 1 && field_end[-1] == '\r') {
+                    debug(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2)
+                    ("WARNING: Double CR characters in HTTP header {%s}\n", getStringPrefix(field_start, field_end));
+                    field_end--;
+                }
+            }
+
+            /* Barf on stray CR characters */
+            if (memchr(this_line, '\r', field_end - this_line)) {
+                debug(55, 1) ("WARNING: suspicious CR characters in HTTP header {%s}\n",
+                              getStringPrefix(field_start, field_end));
+
+                if (Config.onoff.relaxed_header_parser) {
+                    char *p = (char *) this_line;      /* XXX Warning! This destroys original header content and violates specifications somewhat */
+
+                    while ((p = (char *)memchr(p, '\r', field_end - p)) != NULL)
+                        *p++ = ' ';
+                } else
+                    return httpHeaderReset(hdr);
+            }
+
+            if (this_line + 1 == field_end && this_line > field_start) {
+                debug(55, 1) ("WARNING: Blank continuation line in HTTP header {%s}\n",
+                              getStringPrefix(header_start, header_end));
+                return httpHeaderReset(hdr);
+            }
+        } while (field_ptr < header_end && (*field_ptr == ' ' || *field_ptr == '\t'));
+
+        if (field_start == field_end) {
+            if (field_ptr < header_end) {
+                debug(55, 1) ("WARNING: unparseable HTTP header field near {%s}\n",
+                              getStringPrefix(field_start, header_end));
+                return httpHeaderReset(hdr);
+            }
+
+            break;             /* terminating blank line */
+        }
 
         e = httpHeaderEntryParseCreate(field_start, field_end);
 
         if (NULL == e) {
-            debug(55, 1) ("WARNING: ignoring unparseable HTTP header field near '%s'\n",
+            debug(55, 1) ("WARNING: unparseable HTTP header field {%s}\n",
                           getStringPrefix(field_start, field_end));
-        } else if (e->id == HDR_CONTENT_LENGTH && httpHeaderHas(hdr, HDR_CONTENT_LENGTH)) {
-            debug(55, 1) ("WARNING: found double content-length header\n");
-            httpHeaderEntryDestroy(e);
-            return httpHeaderReset(hdr);
-        } else if (e->id == HDR_OTHER && stringHasWhitespace(e->name.buf())) {
-            debug(55, 1) ("WARNING: found whitespace in HTTP header {%s}\n", e->name.buf());
-            httpHeaderEntryDestroy(e);
-            return httpHeaderReset(hdr);
-        } else {
-            httpHeaderAddEntry(hdr, e);
+            debug(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2)
+            (" in {%s}\n", getStringPrefix(header_start, header_end));
+
+            if (Config.onoff.relaxed_header_parser)
+                continue;
+            else
+                return httpHeaderReset(hdr);
         }
 
-        field_start = field_end;
+        if (e->id == HDR_CONTENT_LENGTH && (e2 = httpHeaderFindEntry(hdr, e->id)) != NULL) {
+            if (!Config.onoff.relaxed_header_parser || e->value.cmp(e2->value.buf()) != 0) {
+                debug(55, 1) ("WARNING: found two conflicting content-length headers in {%s}\n", getStringPrefix(header_start, header_end));
+                httpHeaderEntryDestroy(e);
+                return httpHeaderReset(hdr);
+            } else {
+                debug(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2)
+                ("NOTICE: found double content-length header\n");
+            }
+        }
 
-        /* skip CRLF */
+        if (e->id == HDR_OTHER && stringHasWhitespace(e->name.buf())) {
+            debug(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2)
+            ("WARNING: found whitespace in HTTP header name {%s}\n", getStringPrefix(field_start, field_end));
 
-        if (*field_start == '\r')
-            field_start++;
+            if (!Config.onoff.relaxed_header_parser) {
+                httpHeaderEntryDestroy(e);
+                return httpHeaderReset(hdr);
+            }
+        }
 
-        if (*field_start == '\n')
-            field_start++;
+        httpHeaderAddEntry(hdr, e);
     }
 
     return 1;                  /* even if no fields where found, it is a valid header */
@@ -1254,8 +1310,8 @@ httpHeaderEntryParseCreate(const char *field_start, const char *field_end)
     HttpHeaderEntry *e;
     http_hdr_type id;
     /* note: name_start == field_start */
-    const char *name_end = strchr(field_start, ':');
-    const int name_len = name_end ? name_end - field_start : 0;
+    const char *name_end = (const char *)memchr(field_start, ':', field_end - field_start);
+    int name_len = name_end ? name_end - field_start : 0;
     const char *value_start = field_start + name_len + 1;      /* skip ':' */
     /* note: value_end == field_end */
 
@@ -1272,6 +1328,17 @@ httpHeaderEntryParseCreate(const char *field_start, const char *field_end)
         return NULL;
     }
 
+    if (Config.onoff.relaxed_header_parser && xisspace(field_start[name_len - 1])) {
+        debug(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2)
+        ("NOTICE: Whitespace after header name in '%s'\n", getStringPrefix(field_start, field_end));
+
+        while (name_len > 0 && xisspace(field_start[name_len - 1]))
+            name_len--;
+
+        if (!name_len)
+            return NULL;
+    }
+
     /* now we know we can parse it */
     e = new HttpHeaderEntry;
 
@@ -1297,6 +1364,9 @@ httpHeaderEntryParseCreate(const char *field_start, const char *field_end)
     while (value_start < field_end && xisspace(*value_start))
         value_start++;
 
+    while (value_start < field_end && xisspace(field_end[-1]))
+        field_end--;
+
     if (field_end - value_start > 65536) {
         /* String has a 64K limit */
         debug(55, 1) ("WARNING: ignoring '%s' header of %d bytes\n",
index 600725fbf46b082a5cc3107243f19c3c5527760d..61dae30dc8fccf6f17e60c736546ff2b9602e819 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.463 2005/02/09 13:01:40 serassio Exp $
+ * $Id: cache_cf.cc,v 1.464 2005/03/06 14:46:29 serassio Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -2017,10 +2017,39 @@ parse_onoff(int *var)
 }
 
 #define free_onoff free_int
-#define dump_eol dump_string
-#define free_eol free_string
-#define dump_debug dump_string
-#define free_debug free_string
+
+static void
+dump_tristate(StoreEntry * entry, const char *name, int var)
+{
+    const char *state;
+
+    if (var > 0)
+        state = "on";
+    else if (var < 0)
+        state = "warn";
+    else
+        state = "off";
+
+    storeAppendPrintf(entry, "%s %s\n", name, state);
+}
+
+static void
+parse_tristate(int *var)
+{
+    char *token = strtok(NULL, w_space);
+
+    if (token == NULL)
+        self_destruct();
+
+    if (!strcasecmp(token, "on") || !strcasecmp(token, "enable"))
+        *var = 1;
+    else if (!strcasecmp(token, "warn"))
+        *var = -1;
+    else
+        *var = 0;
+}
+
+#define free_tristate free_int
 
 static void
 dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
@@ -2287,6 +2316,9 @@ parse_eol(char *volatile *var)
     *var = xstrdup((char *) token);
 }
 
+#define dump_eol dump_string
+#define free_eol free_string
+
 void
 parse_debug(char *volatile *var)
 {
@@ -2296,6 +2328,9 @@ parse_debug(char *volatile *var)
     Debug::parseOptions(Config.debugOptions);
 }
 
+#define dump_debug dump_string
+#define free_debug free_string
+
 static void
 dump_time_t(StoreEntry * entry, const char *name, time_t var)
 {
index b19f5532ae5df927c1ecf5609495584edcea4d02..e1c35b3a1f9f7b9e805b8b36301a9bf0be8049d6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.240 2005/02/09 13:01:40 serassio Exp $
+ * $Id: enums.h,v 1.241 2005/03/06 14:46:29 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -95,6 +95,7 @@ typedef enum {
     ERR_TOO_BIG,
     TCP_RESET,
     ERR_ESI,                    /* Failure to perform ESI processing */
+    ERR_INVALID_RESP,
     ERR_MAX
 } err_type;
 
index 1d397976bcda0930e8abc3d153ccf0acbd50ad3c..1478fd2099def1153adf7a04533eeba47b9b1c09 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.444 2005/02/14 22:12:57 serassio Exp $
+ * $Id: http.cc,v 1.445 2005/03/06 14:46:29 serassio Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -1010,7 +1010,7 @@ HttpStateData::readReply (int fd, char *readBuf, size_t len, comm_err_t flag, in
             processReplyHeader(buf, len);
         else if (entry->getReply()->sline.status == HTTP_INVALID_HEADER && HttpVersion(0,9) != entry->getReply()->sline.version) {
             ErrorState *err;
-            err = errorCon(ERR_INVALID_REQ, HTTP_BAD_GATEWAY);
+            err = errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY);
             err->request = requestLink((HttpRequest *) request);
             fwdFail(fwd, err);
             do_next_read = 0;
@@ -1040,7 +1040,7 @@ HttpStateData::readReply (int fd, char *readBuf, size_t len, comm_err_t flag, in
                 if (s == HTTP_INVALID_HEADER && httpver != HttpVersion(0,9)) {
                     ErrorState *err;
                     storeEntryReset(entry);
-                    err = errorCon(ERR_INVALID_REQ, HTTP_BAD_GATEWAY);
+                    err = errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY);
                     err->request = requestLink((HttpRequest *) request);
                     fwdFail(fwd, err);
                     comm_close(fd);
index 3a3a21da4d76fb145392415048c41ae0311a3cde..41f010151477865834add6f7dc381aa67a301185 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mime.cc,v 1.115 2004/04/04 23:17:48 hno Exp $
+ * $Id: mime.cc,v 1.116 2005/03/06 14:46:30 serassio Exp $
  *
  * DEBUG: section 25    MIME Parsing
  * AUTHOR: Harvest Derived
@@ -176,7 +176,7 @@ size_t
 headersEnd(const char *mime, size_t l)
 {
     size_t e = 0;
-    int state = 0;
+    int state = 1;
 
     while (e < l && state < 3) {
         switch (state) {
@@ -199,9 +199,7 @@ headersEnd(const char *mime, size_t l)
             break;
 
         case 2:
-            if ('\r' == mime[e])       /* ignore repeated CR */
-                (void) 0;
-            else if ('\n' == mime[e])
+            if ('\n' == mime[e])
                 state = 3;
             else
                 state = 0;
index 8d5399a58a68cfa80a4db1deccbd10a3381f9ac0..082f360742a2864889a4697c3bf1f1c7dcbf16ea 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.510 2005/03/02 20:57:35 hno Exp $
+ * $Id: structs.h,v 1.511 2005/03/06 14:46:31 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -569,6 +569,7 @@ struct _SquidConfig
 
         int request_entities;
         int balance_on_multiple_ip;
+        int relaxed_header_parser;
         int check_hostnames;
         int via;
         int emailErrData;