Changeset 1928
- Timestamp:
- 03/17/08 15:48:25
- Files:
-
- trunk/cherrypy/wsgiserver/__init__.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/wsgiserver/__init__.py
r1920 r1928 678 678 class NoSSLError(Exception): 679 679 """Exception raised when a client speaks HTTP to an HTTPS socket.""" 680 pass 681 682 683 class FatalSSLAlert(Exception): 684 """Exception raised when the SSL implementation signals a fatal alert.""" 680 685 pass 681 686 … … 861 866 pass 862 867 863 if is_reader and thirdarg == 'ssl handshake failure':864 # Return "" to simulate EOF which will close the conn.865 return ""866 868 if thirdarg == 'http request': 867 869 # The client is talking HTTP to an HTTPS server. 868 870 raise NoSSLError() 869 if is_reader and thirdarg == 'decryption failed or bad record mac': 870 # Return "" to simulate EOF which will close the conn. 871 return "" 872 else: 873 raise 871 raise FatalSSLAlert(*e.args) 874 872 except: 875 873 raise … … 957 955 if errnum not in socket_errors_to_ignore: 958 956 if req: 959 fd = open("ssl_errors.txt", "a")960 fd.write("1" * 80)961 fd.write("\n")962 fd.write(str(type(e)))963 fd.write(format_exc())964 957 req.simple_response("500 Internal Server Error", 965 958 format_exc()) … … 967 960 except (KeyboardInterrupt, SystemExit): 968 961 raise 962 except FatalSSLAlert, e: 963 # Close the connection. 964 return 969 965 except NoSSLError: 970 966 # Unwrap our wfile … … 974 970 "this server only speaks HTTPS on this port.") 975 971 except Exception, e: 976 fd = open("ssl_errors.txt", "a")977 fd.write("2" * 80)978 fd.write("\n")979 fd.write(format_exc())980 972 if req: 981 973 req.simple_response("500 Internal Server Error", format_exc())

