Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
guonaihong committed Jun 12, 2024
1 parent 88b706a commit 3e465ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func (p *Parser) Execute(setting *Setting, buf []byte) (success int, err error)
if p.hasContentLength {
nread := min(int32(len(buf[i:])), p.contentLength)
if setting.Body != nil && nread > 0 {
setting.Body(p, buf[i:int32(i)+nread], i)
setting.Body(p, buf[i:int32(i)+nread], i+int(nread))
}

p.contentLength -= nread
Expand All @@ -640,7 +640,7 @@ func (p *Parser) Execute(setting *Setting, buf []byte) (success int, err error)

case bodyIdentityEOF:
if setting.Body != nil {
setting.Body(p, buf[i:], i)
setting.Body(p, buf[i:], i+len(buf[i:]))
i = len(buf) - 1
}

Expand Down Expand Up @@ -693,7 +693,7 @@ func (p *Parser) Execute(setting *Setting, buf []byte) (success int, err error)
case chunkedData:
nread := min(int32(len(buf[i:])), p.contentLength)
if setting.Body != nil && nread > 0 {
setting.Body(p, buf[chunkDataStartIndex:int32(chunkDataStartIndex)+nread], i)
setting.Body(p, buf[chunkDataStartIndex:int32(chunkDataStartIndex)+nread], chunkDataStartIndex+int(nread))
}

p.contentLength -= nread
Expand Down

0 comments on commit 3e465ee

Please sign in to comment.