Method SSL.Connection()->got_data()


Method got_data

string(8bit)|int(-1..1) got_data(string(8bit) data)

Description

Main receive handler.

Parameter data

String of data received from the peer.

Returns

Returns one of:

string(0)

Returns an empty string if there's neither application data nor errors (eg during the initial handshake).

string(8bit)

Returns a string of received application data.

int(1)

Returns 1 if the peer has closed the connection.

int(-1)

Returns -1 if an error has occurred.

These are the main cases of errors:

  • There was a low-level protocol communications failure (the data didn't look like an SSL packet), in which case the alert_callback will be called with the raw packet data. This can eg be used to detect HTTP clients connecting to an HTTPS server and similar.

  • The peer has sent an Alert packet, and handle_alert() for it has returned -1.

  • The peer has sent an unsupported/illegal sequence of packets, in which case a suitable Alert will have been generated and queued for sending to the peer.

This function is intended to be called from an i/o read callback.