Branch: Tag:

2014-11-13

2014-11-13 12:50:51 by Henrik Grubbström (Grubba) <grubba@grubba.org>

SSL.Connection: Fixed race condition with alert callbacks.

to_write() could get called with the pending alert before
the alert callback had determined what to do about the alert.

This caused the http to https redirect fallback in Roxen to fail,
due to to_write() having closed the stream before the callback
could steal it.

765:    if (packet->is_alert)    { /* Reply alert */    SSL3_DEBUG_MSG("SSL.Connection: Bad received packet\n"); -  send_packet(packet); +     if (alert_callback)    alert_callback(packet, current_read_state->seq_num, alert_context); -  +  if (this && packet) +  send_packet(packet);    if ((!packet) || (!this) || (packet->level == ALERT_fatal))    return -1;    if (alert_callback)