cheroot.makefile module#

Socket file object.

class cheroot.makefile.BufferedWriter(raw, buffer_size=8192)#

Bases: BufferedWriter

Faux file object attached to a socket object.

_abc_impl = <_abc._abc_data object>#
_flush_unlocked()#
close()#

Close the stream and its underlying file object.

This method is designed to be idempotent (it can be called multiple times without side effects). It gracefully handles a race condition where the underlying socket may have already been closed by the remote client or another thread.

A ConnectionError or OSError with EBADF or ENOTCONN is caught and ignored, as these indicate a normal, expected connection teardown. Other exceptions are re-raised.

write(b)#

Write bytes to buffer.

cheroot.makefile.MakeFile(sock, mode='r', bufsize=8192)#

File object attached to a socket object.

class cheroot.makefile.StreamReader(sock, mode='r', bufsize=8192)#

Bases: BufferedReader

Socket stream reader.

_abc_impl = <_abc._abc_data object>#
has_data()#

Return true if there is buffered data to read.

read(*args, **kwargs)#

Capture bytes read.

class cheroot.makefile.StreamWriter(sock, mode='w', bufsize=8192)#

Bases: BufferedWriter

Socket stream writer.

_abc_impl = <_abc._abc_data object>#
write(val, *args, **kwargs)#

Capture bytes written.