Branch: Tag:

2015-04-13

2015-04-13 11:37:55 by Martin Nilsson <nilsson@opera.com>

Put data into the read buffer without abstractions that doesn't make sense anymore. Give alert_callback the raw received data for the current call.

507:      //! Low-level receive handler. Returns a packet, an alert, or zero if   //! more data is needed to get a complete packet. - protected Packet recv_packet(string(8bit) data) + protected Packet recv_packet()   {    int(0..1)|Packet res;    -  read_buffer->add(data); -  -  // SSL3_DEBUG_MSG("SSL.Connection->recv_packet(%O)\n", data); +     if (!packet)    packet = Packet(version, 2048);   
922:    // That enables the caller to check for a clean close, and    // to get the leftovers after the SSL connection.    +  read_buffer->add(data); +     string(8bit) res = "";    Packet packet; -  while (packet = recv_packet(data)) +  while (packet = recv_packet())    { -  data = ""; -  +     if (packet->is_alert)    { /* Reply alert */    SSL3_DEBUG_MSG("SSL.Connection: Bad received packet\n");    if (alert_callback) -  alert_callback(packet, current_read_state->seq_num, -  (string)read_buffer); +  alert_callback(packet, current_read_state->seq_num, data);    if (this && packet)    send_packet(packet);    if ((!packet) || (!this) || (packet->level == ALERT_fatal))
1123:    }    }    } +     if (sizeof(res)) return res;    if (state & CONNECTION_peer_closed) return 1;    return "";   }