314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
|
-
+
+
+
+
+
+
+
+
+
+
-
+
+
|
return false;
} else
return true;
}
if (status == GNUTLS_E_SUCCESS)
_handshakeDone = true;
else
else {
OFTLSStreamErrorCode errorCode =
OFTLSStreamErrorCodeUnknown;
if (status == GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR)
errorCode = certificateStatusToErrorCode(
gnutls_session_get_verify_cert_status(
_session));
/* FIXME: Map to better errors */
exception = [OFTLSHandshakeFailedException
exceptionWithStream: self
host: _host
errorCode: OFTLSStreamErrorCodeUnknown];
errorCode: errorCode];
}
}
if ([_delegate respondsToSelector:
@selector(stream:didPerformClientHandshakeWithHost:exception:)])
[_delegate stream: self
didPerformClientHandshakeWithHost: _host
exception: exception];
|
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
|
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
|
-
+
+
+
+
+
+
+
+
+
+
-
+
+
|
runLoopMode: runLoopMode];
return nil;
}
}
if (status == GNUTLS_E_SUCCESS)
_handshakeDone = true;
else
else {
OFTLSStreamErrorCode errorCode =
OFTLSStreamErrorCodeUnknown;
if (status == GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR)
errorCode = certificateStatusToErrorCode(
gnutls_session_get_verify_cert_status(
_session));
/* FIXME: Map to better errors */
exception = [OFTLSHandshakeFailedException
exceptionWithStream: self
host: _host
errorCode: OFTLSStreamErrorCodeUnknown];
errorCode: errorCode];
}
}
if ([_delegate respondsToSelector:
@selector(stream:didPerformClientHandshakeWithHost:exception:)])
[_delegate stream: self
didPerformClientHandshakeWithHost: _host
exception: exception];
[_delegate release];
return nil;
}
@end
|