Pike v8.0 release 1738

Class SSL.File

Description

Interface similar to Stdio.File.

  • Handles blocking and nonblocking mode.

  • Handles callback mode in an arbitrary backend (also in blocking mode).

  • Read and write operations may each do both reading and writing. In callback mode that means that installing either a read or a write callback may install both internally.

  • In Pike 8.0 and later, blocking read and write in concurrent threads is supported.

  • Callback changing operations like set_blocking and set_nonblocking aren't atomic.

  • Apart from the above, thread safety/atomicity characteristics are retained.

  • Blocking characterstics are retained for all functions.

  • is_open, connection init (create) and close (close) can do both reading and writing.

  • destroy attempts to close the stream properly by sending the close packet, but since it can't do blocking I/O it's not certain that it will succeed. The stream should therefore always be closed with an explicit close call.

  • Abrupt remote close without the proper handshake gets the errno System.EPIPE.

  • Objects do not contain cyclic references, so they are closed and destructed timely when dropped.


Variable application_protocol

string SSL.File.application_protocol

Description

The application protocol chosen by the client during application layer protocol negotiation (ALPN).

Note

Read only


Variable fragment_max_size

protected int SSL.File.fragment_max_size

Description

The max amount of data to send in each packet. Initialized from the context when the object is created.


Method create

SSL.File SSL.File(Stdio.File stream, SSL.Context ctx)

Description

Create an SSL connection over an open stream.

Parameter stream

Open socket or pipe to create the connection over.

Parameter ctx

The SSL context.

The backend used by stream is taken over and restored after the connection is closed (see close and shutdown). The callbacks and id in stream are overwritten.

Note

The operation mode defaults to nonblocking mode.

See also

accept(), connect()


Method destroy

protected void destroy()

Description

Try to close down the connection properly since it's customary to close files just by dropping them. No guarantee can be made that the close packet gets sent successfully though, because we can't risk blocking I/O here. You should call close explicitly.

See also

close