Skip to main content
ctrlrun.transport.HTTPConnection — class, defined at src/ctrlrun/transport.py:112
http.client.HTTPConnection, plus NotExecuted from connect() where it is proven. A drop-in subclass: the constructor and every method are http.client’s, and what reaches the wire is byte for byte what http.client sends. Two things are recorded for the life of the object, and neither is ever cleared:
  • the mark: set in send, immediately before the first byte is handed to the socket and after any connect send itself triggers, so a sendall that raises part way counts as having written. http.client writes every request byte, a tunnel’s CONNECT line included, through send (T229b pins that on every supported Python). The same send marks the executor run’s register, and where there is none, every register open in the process (§12.2.13);
  • a foreign socket: any socket assigned to sock other than by this object’s own connect().
connect() raises NotExecuted, chained from the original exception, only for an Exception from the connect it wraps, inside an executor run whose register is unmarked, on an object whose mark is unset and which never held a foreign socket. Everything else propagates as it was raised: a reused connection, a second connection after any byte of the run was offered, a caller’s socket, a call outside any executor run, a failure after a byte was offered, an exception in this code’s own bookkeeping, and any BaseException (an interrupt is never turned into a retry permission). The object’s own mark is not subsumed by the register: a thread that did not copy the executor’s context has no register, and a request it delivers on this connection is still remembered here when the executor’s thread reuses the object. Bytes a caller writes to sock itself, rather than through send, are outside both, exactly as bytes sent by another client are.

Next