Otherwise it would be done on the first read/write operation, making
error handling more difficult (such as EOF during handshake).
Reviewed-by: iustinp
# keep-alive settings, see "man 7 tcp" for TCP_KEEPCNT, TCP_KEEPIDLE and
# TCP_KEEPINTVL.
+ # Do the secret SSL handshake
+ if self.using_ssl:
+ self.sock.set_connect_state()
+ try:
+ http.Handshake(self.poller, self.sock, self.WRITE_TIMEOUT)
+ except http.HttpSessionHandshakeUnexpectedEOF:
+ raise http.HttpError("Server closed connection during SSL handshake")
+
def _SendRequest(self):
"""Sends request to server.
request_msg_reader = None
force_close = True
try:
+ # Do the secret SSL handshake
+ if self.server.using_ssl:
+ self.sock.set_accept_state()
+ try:
+ http.Handshake(self.poller, self.sock, self.WRITE_TIMEOUT)
+ except http.HttpSessionHandshakeUnexpectedEOF:
+ # Ignore rest
+ return
+
try:
try:
request_msg_reader = self._ReadRequest()