pike.git / lib / modules / SSL.pmod / Connection.pike

version» Context lines:

pike.git/lib/modules/SSL.pmod/Connection.pike:500:   //! and raw data as arguments, if a bad packet is received.   //!   //! Can be used to support a fallback redirect https->http.   void set_alert_callback(function(object,int|object,string:void) callback)   {    alert_callback = callback;   }      //! 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);       res = packet->recv(read_buffer);       if(objectp(res))    return [object(Packet)]res;       if (res)    { /* Finished a packet */
pike.git/lib/modules/SSL.pmod/Connection.pike:915:   string(8bit)|int got_data(string(8bit) data)   {    if (state & CONNECTION_peer_closed) {    // The peer has closed the connection.    return 1;    }    // If closing we continue to try to read a remote close message.    // 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))    return -1;    if (alert_callback)    break;    }    else    {    SSL3_DEBUG_MSG("SSL.Connection: received packet of type %d\n",
pike.git/lib/modules/SSL.pmod/Connection.pike:1116:       // RFC 4346 6:    // If a TLS implementation receives a record type it does not    // understand, it SHOULD just ignore it.    SSL3_DEBUG_MSG("SSL.Connection: Ignoring packet of type %s\n",    fmt_constant(packet->content_type, "PACKET"));    break;    }    }    } +     if (sizeof(res)) return res;    if (state & CONNECTION_peer_closed) return 1;    return "";   }