--- /home/chrism/projects/websafe/src/Python-2.3.4/Lib/cgi.py 2005-01-24 03:01:28.000000000 -0500 +++ /home/chrism/projects/websafe/opt/Python-2.3.4/lib/python2.3/cgi.py 2005-03-31 21:43:52.891180587 -0500 @@ -689,7 +689,7 @@ def read_lines_to_eof(self): """Internal: read lines until EOF.""" while 1: - line = self.fp.readline() + line = self.fp.readline(1<<16) if not line: self.done = -1 break @@ -700,12 +700,13 @@ next = "--" + self.outerboundary last = next + "--" delim = "" + last_line_lfend = True while 1: - line = self.fp.readline() + line = self.fp.readline(1<<16) if not line: self.done = -1 break - if line[:2] == "--": + if line[:2] == "--" and last_line_lfend: strippedline = line.strip() if strippedline == next: break @@ -716,11 +717,14 @@ if line[-2:] == "\r\n": delim = "\r\n" line = line[:-2] + last_line_lfend = True elif line[-1] == "\n": delim = "\n" line = line[:-1] + last_line_lfend = True else: delim = "" + last_line_lfend = False self.__write(odelim + line) def skip_lines(self): @@ -729,18 +733,23 @@ return next = "--" + self.outerboundary last = next + "--" + last_line_lfend = True while 1: - line = self.fp.readline() + line = self.fp.readline(1<<16) if not line: self.done = -1 break - if line[:2] == "--": + if line[:2] == "--" and last_line_lfend: strippedline = line.strip() if strippedline == next: break if strippedline == last: self.done = 1 break + if line.endswith('\n'): + last_line_lfend = True + else: + last_line_lfend = False def make_file(self, binary=None): """Overridable: return a readable & writable file.