  Packet losses are common events in today's networks. They usually result in
longer delivery times for application data since retransmissions are the de
facto technique to recover from such losses. Retransmissions is a good strategy
for many applications but it may lead to poor performance with
latency-sensitive applications compared to network coding. Although different
types of network coding techniques have been proposed to reduce the impact of
losses by transmitting redundant information, they are not widely used. Some
niche applications include their own variant of Forward Erasure Correction
(FEC) techniques, but there is no generic protocol that enables many
applications to easily use them. We close this gap by designing, implementing
and evaluating a new Flexible Erasure Correction (FlEC) framework inside the
newly standardized QUIC protocol. With FlEC, an application can easily select
the reliability mechanism that meets its requirements, from pure
retransmissions to various forms of FEC. We consider three different use cases:
$(i)$ bulk data transfer, $(ii)$ file transfers with restricted buffers and
$(iii)$ delay-constrained messages. We demonstrate that modern transport
protocols such as QUIC may benefit from application knowledge by leveraging
this knowledge in FlEC to provide better loss recovery and stream scheduling.
Our evaluation over a wide range of scenarios shows that the FlEC framework
outperforms the standard QUIC reliability mechanisms from a latency viewpoint.
