summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:53:22 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:53:22 +0000
commitc901051d43e68c2edd91360830b4f279a8896e15 (patch)
treee176ccefad0fe1b20b152a40d18379dd66b7382e /methods
parenteb6a718efeb2b7bea3b52890af7ecbcacfc0ed74 (diff)
Fixed cisco cacheengine lameness
Author: jgg Date: 1999-04-04 02:02:04 GMT Fixed cisco cacheengine lameness
Diffstat (limited to 'methods')
-rw-r--r--methods/http.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/methods/http.cc b/methods/http.cc
index 0d84a9dc7..4bd7975a4 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: http.cc,v 1.29 1999/03/15 07:20:41 jgg Exp $
+// $Id: http.cc,v 1.30 1999/04/04 02:02:04 jgg Exp $
/* ######################################################################
HTTP Aquire Method - This is the HTTP aquire method for APT.
@@ -504,11 +504,22 @@ bool ServerState::HeaderLine(string Line)
string::size_type Pos = Line.find(' ');
if (Pos == string::npos || Pos+1 > Line.length())
- return _error->Error("Bad header line");
-
- string Tag = string(Line,0,Pos);
- string Val = string(Line,Pos+1);
+ {
+ // Blah, some servers use "connection:closes", evil.
+ Pos = Line.find(':');
+ if (Pos == string::npos || Pos + 2 > Line.length())
+ return _error->Error("Bad header line");
+ Pos++;
+ }
+ // Parse off any trailing spaces between the : and the next word.
+ string::size_type Pos2 = Pos;
+ while (Pos2 < Line.length() && isspace(Line[Pos2]) != 0)
+ Pos2++;
+
+ string Tag = string(Line,0,Pos);
+ string Val = string(Line,Pos2);
+
if (stringcasecmp(Tag.begin(),Tag.begin()+4,"HTTP") == 0)
{
// Evil servers return no version