http: make numWant optional

The default numwant value should be used if either numwant is zero or omitted from the announce request.
This commit is contained in:
tom 2017-04-20 18:48:57 +01:00
parent 9f45950dd0
commit cdb0ff3612

View file

@ -63,7 +63,7 @@ func ParseAnnounce(r *http.Request, realIPHeader string, allowIPSpoofing bool) (
}
numwant, err := qp.Uint64("numwant")
if err != nil {
if err != nil && err != bittorrent.ErrKeyNotFound {
return nil, bittorrent.ClientError("failed to parse parameter: numwant")
}
request.NumWant = uint32(numwant)