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

version» Context lines:

pike.git/lib/modules/SSL.pmod/Connection.pike:525:    case 1:    // Finished a packet    if (current_read_state)    SSL3_DEBUG_MSG("SSL.Connection->recv_packet(): version=0x%x\n",    version);    return current_read_state->decrypt_packet(packet);    case 0:    SSL3_DEBUG_MSG("SSL.Connection->recv_packet(): current_read_state is zero!\n");    return 0;    case -1: +  if( state & CONNECTION_handshaking ) +  { +  // This is likely HTTP request on the TLS port. We could parse +  // the path and host header, and create a request with https:// +  // schema. Would need to go through context for several +  // reasons. This could be a non-HTTP port or we would want to +  // use HSTS. +  SSL3_DEBUG_MSG("Initial incorrect data %O\n", +  ((string)read_buffer[..25])); +  }    return alert(ALERT_fatal, ALERT_unexpected_message);    default:    error("Internal error.\n");    }       return 0;   }      //! Queues a packet for write. Handshake and and change cipher   //! must use the same priority, so must application data and
pike.git/lib/modules/SSL.pmod/Connection.pike:933:    string(8bit) res = "";    Packet packet;    while (packet = recv_packet())    {    if (packet->is_alert)    {    // recv_packet returns packets with is_alert set if it is    // generated on our side, as opposed to an alert that is    // received. These are always fatal (wrong packet type, packet    // version, packet size). -  SSL3_DEBUG_MSG("SSL.Connection: Bad received packet\n"); +  SSL3_DEBUG_MSG("SSL.Connection: Bad received packet (%s)\n", +  fmt_constant([int]packet->description, "ALERT"));    if (alert_callback)    {    Stdio.Buffer.RewindKey here = read_buffer->rewind_key();    read_buffer_key->rewind();    alert_callback(packet, current_read_state->seq_num,    (string)read_buffer);    here->rewind();    }       // We or the packet may have been destructed by the