File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -740,8 +740,8 @@ type lenReadSeeker interface {
740740
741741type dummyReadCloser struct {
742742 orig any // string or []byte
743+ mu sync.Mutex // protects operations over body
743744 body lenReadSeeker // instanciated on demand from orig
744- mu sync.Mutex
745745}
746746
747747// copy returns a new instance resetting d.body to nil.
@@ -767,6 +767,9 @@ func (d *dummyReadCloser) setup() {
767767}
768768
769769func (d * dummyReadCloser ) Read (p []byte ) (n int , err error ) {
770+ d .mu .Lock ()
771+ defer d .mu .Unlock ()
772+
770773 d .setup ()
771774 return d .body .Read (p )
772775}
@@ -781,6 +784,9 @@ func (d *dummyReadCloser) Close() error {
781784}
782785
783786func (d * dummyReadCloser ) Len () int {
787+ d .mu .Lock ()
788+ defer d .mu .Unlock ()
789+
784790 d .setup ()
785791 return d .body .Len ()
786792}
You can’t perform that action at this time.
0 commit comments