Expect 200 OK in torrent source response
This commit is contained in:
parent
6f9390a125
commit
6e760a6210
|
@ -2,6 +2,7 @@ package torrent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/anacrolix/log"
|
"github.com/anacrolix/log"
|
||||||
|
@ -66,6 +67,10 @@ func getTorrentSource(ctx context.Context, source string, hc *http.Client) (mi m
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
if resp.StatusCode != http.StatusOK {
|
||||||
|
err = fmt.Errorf("unexpected response status code: %v", resp.StatusCode)
|
||||||
|
return
|
||||||
|
}
|
||||||
err = bencode.NewDecoder(resp.Body).Decode(&mi)
|
err = bencode.NewDecoder(resp.Body).Decode(&mi)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue