SplitHTTP: Do not produce too large upload (#3691)

This commit is contained in:
mmmray 2024-08-17 13:01:58 +02:00 committed by GitHub
parent 1562e1ffb9
commit 160316d53c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 108 additions and 6 deletions

View file

@ -46,6 +46,14 @@ var (
errSlowDown = errors.New("slow down")
)
func (p *pipe) Len() int32 {
data := p.data
if data == nil {
return 0
}
return data.Len()
}
func (p *pipe) getState(forRead bool) error {
switch p.state {
case open:

View file

@ -19,6 +19,10 @@ func (w *Writer) Close() error {
return w.pipe.Close()
}
func (w *Writer) Len() int32 {
return w.pipe.Len()
}
// Interrupt implements common.Interruptible.
func (w *Writer) Interrupt() {
w.pipe.Interrupt()