Message8218

Author jeff.allen
Recipients jeff.allen
Date 2014-01-08.21:55:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1389218116.25.0.167007891822.issue2109@psf.upfronthosting.co.za>
In-reply-to
Content
For the record, test_request_line_trimming fails as follows. The essence of the test is to insert an extra \n at the end of a GET request line. The request is syntactically invalid. The \n\r\n appears like two blank lines, implying no headers, but the headers then follow where no data should be. The server is supposed to respond with status 501, because it does not, in fact, define a GET operation.

Windows "corrects" the \n to \r\n, which is ok, but it holds back the unexpected data (displaced headers). When the server returns a 501 response and closes the connection, the client now in getresponse() appears not to get the response, before it errors on the closure.

If the following trace, I replaced BaseHTTPRequestHandler, with a version that has lots of extra logging:

test_request_line_trimming (__main__.BaseHTTPServerTestCase) ... send: 'GET / HTTP/1.1\n\r\nHost: lo
calhost:49816\r\nAccept-Encoding: identity\r\n\r\n'

127.0.0.1 - - [08/Jan/2014 20:37:52] (parse_request) raw request line: 'GET / HTTP/1.1\r\n'
127.0.0.1 - - [08/Jan/2014 20:37:52] (parse_request) words: ['GET', '/', 'HTTP/1.1']
127.0.0.1 - - [08/Jan/2014 20:37:52] (parse_request) look-ahead: '\r\n'
127.0.0.1 - - [08/Jan/2014 20:37:52] (parse_request) headers: []
127.0.0.1 - - [08/Jan/2014 20:37:52] (parse_request) look-ahead: ''
127.0.0.1 - - [08/Jan/2014 20:37:52] (handle_one_request) socket (u'127.0.0.1', 49816)
127.0.0.1 - - [08/Jan/2014 20:37:52] code 501, message Unsupported method ('GET')
127.0.0.1 - - [08/Jan/2014 20:37:52] "GET / HTTP/1.1" 501 -
127.0.0.1 - - [08/Jan/2014 20:37:52] (send_response) HTTP/1.1 501 "Unsupported method ('GET')"
127.0.0.1 - - [08/Jan/2014 20:37:52] (send_header) Server: BaseHTTP/0.3 Python/2.7b1+
127.0.0.1 - - [08/Jan/2014 20:37:52] (send_header) Date: Wed, 08 Jan 2014 20:37:52 GMT
127.0.0.1 - - [08/Jan/2014 20:37:52] (send_header) Content-Type: text/html
127.0.0.1 - - [08/Jan/2014 20:37:52] (send_header) Connection: close
ERROR

ERROR: test_request_line_trimming (__main__.BaseHTTPServerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "jython-trunk\dist\Lib\test\test_httpservers.py", line 197, i
n test_request_line_trimming
    res = self.con.getresponse()
  File "jython-trunk\dist\Lib\httplib.py", line 1045, in getresponse

    response.begin()
  File "jython-trunk\dist\Lib\httplib.py", line 409, in begin
    version, status, reason = self._read_status()
  File "jython-trunk\dist\Lib\httplib.py", line 365, in _read_status

    line = self.fp.readline(_MAXLINE + 1)
  File "jython-trunk\dist\Lib\socket.py", line 1733, in readline
    data = self._sock.recv(self._rbufsize)
  File "jython-trunk\dist\Lib\socket.py", line 174, in handle_except
ion
    raise _map_exception(jlx)
error: [Errno 10054] Software caused connection abort
History
Date User Action Args
2014-01-08 21:55:16jeff.allensetmessageid: <1389218116.25.0.167007891822.issue2109@psf.upfronthosting.co.za>
2014-01-08 21:55:16jeff.allensetrecipients: + jeff.allen
2014-01-08 21:55:16jeff.allenlinkissue2109 messages
2014-01-08 21:55:15jeff.allencreate