TsgcWebTransportStream › Properties › HeaderSent
Bookkeeping flag recording that the stream's WebTransport header has been written. The library manages it; applications neither read nor write it.
property HeaderSent: Boolean read FHeaderSent write FHeaderSent;
Boolean (bool in C++Builder).
False at construction. It becomes True almost immediately: OpenStream sets it after writing the header, and AddIncomingStream sets it at once because the peer already sent one. By the time your code sees a stream it is always True.
Every WebTransport stream opens with a header naming its session, varint(0x54) + varint(SessionId) for a unidirectional stream or varint(0x41) + varint(SessionId) for a bidirectional one. It must appear exactly once, at the very front. HeaderSent is the flag that records it has happened.
Do not write it. The setter is public because OpenStream and AddIncomingStream live outside the stream class and must set it. Nothing good comes of an application touching it: it records a fact about bytes already on the wire, and changing the flag does not change those bytes.
Do not read it as a readiness check either. It is tempting to test it before writing, but it tells you nothing useful: it is True on every stream you can reach. A stream is ready to write when you have it, and StreamId is the property to check when you want to know whether a real QUIC stream was bound.
The flag exists for the library's own bookkeeping, and is documented here only because it is public. Treat it as an implementation detail.
This member is currently available in the Delphi/C++Builder implementation only. The .NET class has no equivalent: there the header is written by the transport's open-stream hook, so no flag is kept on the stream object.
// Applications do not use HeaderSent. This shows only where the library
// sets it, so its meaning is clear.
// In OpenStream: the header is written, then the fact is recorded
// Result.DoWriteBytes(vHeader);
// Result.HeaderSent := True;
// In AddIncomingStream: the PEER sent the header, so it is already true
// Result := TsgcWebTransportStream.Create(Self, aStreamId, aUnidirectional);
// Result.HeaderSent := True;
// Every stream you can reach already has HeaderSent = True, so this test
// is always taken and tells you nothing:
if FStream.HeaderSent then
FStream.WriteData('payload');
// Just write. If you need to know a QUIC stream was bound, check StreamId:
if FStream.StreamId >= 0 then
FStream.WriteData('payload');