Opened 11 years ago

Last modified 11 years ago

#44 defect closed fixed (fixed)

bug in http.py caused by IE

Reported by: radix Owned by:
Priority: high Milestone:
Component: Keywords:
Cc: radix Branch:
Author: Launchpad Bug:

Description


Change History (3)

comment:1 Changed 11 years ago by radix

I've been reviewing the http.py code. It seems there's a bug
in the
following, when there is an IE connect.

def lineReceived(self, line):
if self.__first_line:
# if this connection is not persistent, drop any data which
# the client (illegally) sent after the last request.
if not self.persistent:
self.dataReceived = self.lineReceived = lambda *args: None
return

# create a new Request object
request = self.requestFactory(self, len(self.requests))
self.requests.append(request)

# IE sends an extraneous empty line (\r\n) after a POST
request;
# eat up such a line, but only ONCE
if not line and self.__first_line == 1:
self.__first_line = 2
return


As written, IE with the bug will create two Request objects.

Here's a bugfix, which swaps the last two sections

def lineReceived(self, line):
if self.__first_line:
# if this connection is not persistent, drop any data which
# the client (illegally) sent after the last request.
if not self.persistent:
self.dataReceived = self.lineReceived = lambda *args: None
return

# IE sends an extraneous empty line (\r\n) after a POST
request;
# eat up such a line, but only ONCE
if not line and self.__first_line == 1:
self.__first_line = 2
return

# create a new Request object
request = self.requestFactory(self, len(self.requests))
self.requests.append(request)


Andrew

comment:2 Changed 11 years ago by radix

implemented your fix

comment:3 Changed 3 years ago by <automation>

Note: See TracTickets for help on using tickets.