Changeset 1538
- Timestamp:
- 12/20/06 16:37:49
- Files:
-
- trunk/cherrypy/wsgiserver.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/wsgiserver.py
r1537 r1538 107 107 # (although your TCP stack might suffer for it: cf Apache's history 108 108 # with FIN_WAIT_2). 109 request_line = self.rfile.readline() 110 if not request_line: 111 # Force self.ready = False so the connection will close. 112 self.ready = False 113 return 109 while True: 110 request_line = self.rfile.readline() 111 if not request_line: 112 # Force self.ready = False so the connection will close. 113 self.ready = False 114 return 115 elif request_line == "\r\n": 116 # "...if the server is reading the protocol stream at the 117 # beginning of a message and receives a CRLF first, it 118 # should ignore the CRLF." RFC 2616 sec 4.1 119 pass 120 else: 121 break 114 122 115 123 server = self.connection.server … … 316 324 try: 317 325 for chunk in response: 318 if not self.sent_headers: 319 self.sent_headers = True 320 self.send_headers() 321 if self.chunked_write: 322 wfile.write(hex(len(chunk))[2:]) 323 wfile.write("\r\n") 324 wfile.write(chunk) 325 wfile.write("\r\n") 326 else: 327 wfile.write(chunk) 328 wfile.flush() 326 self.write(chunk) 329 327 finally: 330 328 if hasattr(response, "close"): … … 369 367 return self.write 370 368 371 def write(self, d):369 def write(self, chunk): 372 370 if not self.sent_headers: 373 371 self.sent_headers = True 374 372 self.send_headers() 375 self.connection.wfile.write(d) 376 self.connection.wfile.flush() 373 wfile = self.connection.wfile 374 if self.chunked_write: 375 wfile.write(hex(len(chunk))[2:]) 376 wfile.write("\r\n") 377 wfile.write(chunk) 378 wfile.write("\r\n") 379 else: 380 wfile.write(chunk) 381 wfile.flush() 377 382 378 383 def send_headers(self):

