Changeset 894
- Timestamp:
- 12/29/05 12:33:13
- Files:
-
- trunk/cherrypy/lib/httptools.py (modified) (3 diffs)
- trunk/cherrypy/test/test_core.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/lib/httptools.py
r843 r894 416 416 417 417 class SizeCheckWrapper(object): 418 """ Wrapper around an rfile object. For each data reading method, 419 it reads the data but it checks that the size of the data doesn't 420 exceed a certain limit 421 """ 418 """Wraps a file-like object, raising MaxSizeExceeded if too large.""" 419 422 420 def __init__(self, rfile, maxlen): 423 421 self.rfile = rfile … … 441 439 self._check_length() 442 440 return data 443 441 444 442 # User didn't specify a size ... 445 443 # We read the line in chunks to make sure it's not a 100MB line ! … … 450 448 self._check_length() 451 449 res.append(data) 452 if len(data) < 256: 450 # See http://www.cherrypy.org/ticket/421 451 if len(data) < 256 or data[-1:] == "\n": 453 452 return ''.join(res) 454 453 trunk/cherrypy/test/test_core.py
r892 r894 571 571 protocol = cherrypy.config.get('server.protocol_version') 572 572 if protocol == "HTTP/1.1": 573 self.assertBody("(['http://127.0.0.1: 8000/'], 303)")573 self.assertBody("(['http://127.0.0.1:%s/'], 303)" % self.PORT) 574 574 else: 575 self.assertBody("(['http://127.0.0.1: 8000/'], 302)")575 self.assertBody("(['http://127.0.0.1:%s/'], 302)" % self.PORT) 576 576 577 577 def testFlatten(self): … … 835 835 self.assertHeader('Set-Cookie', 'First=Dinsdale;') 836 836 self.assertHeader('Set-Cookie', 'Last=Piranha;') 837 837 838 838 def testMaxRequestSize(self): 839 839 self.getPage("/maxrequestsize/index") … … 847 847 self.assertInBody("Request Entity Too Large") 848 848 cherrypy.config.update({'server.max_request_header_size': 0}) 849 850 # Test for http://www.cherrypy.org/ticket/421 851 # (Incorrect border condition in readline of SizeCheckWrapper). 852 # This hangs in rev 891 and earlier. 853 lines256 = "x" * 248 854 self.getPage("/maxrequestsize/index", 855 headers=[('Host', '127.0.0.1:%s' % self.PORT), 856 ('From', lines256)]) 849 857 850 858 # Test upload

