Changeset 1618
- Timestamp:
- 02/16/07 13:21:12
- Files:
-
- trunk/cherrypy/wsgiserver/__init__.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/wsgiserver/__init__.py
r1616 r1618 478 478 buf.append("\r\n") 479 479 self.sendall("".join(buf)) 480 481 482 class NoSSLError(Exception): 483 """Exception raised when a client speaks HTTP to an HTTPS socket.""" 484 pass 480 485 481 486 … … 509 514 if is_reader and e.args == (-1, 'Unexpected EOF'): 510 515 return "" 511 if is_reader and e.args[0][0][2] == 'ssl handshake failure': 516 517 thirdarg = None 518 try: 519 thirdarg = e.args[0][0][2] 520 except IndexError: 521 pass 522 523 if is_reader and thirdarg == 'ssl handshake failure': 512 524 return "" 525 if thirdarg == 'http request': 526 # The client is talking HTTP to an HTTPS server. 527 raise NoSSLError() 513 528 raise 514 529 if time.time() - start > self.ssl_timeout: … … 619 634 except (KeyboardInterrupt, SystemExit): 620 635 raise 636 except NoSSLError: 637 # Unwrap our sendall 638 req.sendall = self.socket._sock.sendall 639 req.simple_response("400 Bad Request", 640 "The client sent a plain HTTP request, but " 641 "this server only speaks HTTPS on this port.") 621 642 except: 622 643 if req:

