Ignore unused trailing bytes in HTTP tracker responses

This commit is contained in:
Matt Joiner 2018-08-13 20:24:15 +10:00
parent 3ffacb117f
commit 066809403a
1 changed files with 3 additions and 1 deletions

View File

@ -109,7 +109,9 @@ func announceHTTP(opt Announce, _url *url.URL) (ret AnnounceResponse, err error)
}
var trackerResponse httpResponse
err = bencode.Unmarshal(buf.Bytes(), &trackerResponse)
if err != nil {
if _, ok := err.(bencode.ErrUnusedTrailingBytes); ok {
err = nil
} else if err != nil {
err = fmt.Errorf("error decoding %q: %s", buf.Bytes(), err)
return
}