mirror of
https://github.com/aykhans/sarin.git
synced 2026-10-16 14:43:53 +00:00
refactor(script): drop the per-call maxBodySize and its client cache
This commit is contained in:
10 files changed
+54
-146
No files matched your search
@@ -79,6 +79,11 @@ func fetchHTTP(ctx context.Context, url string) ([]byte, error) {
|
||||
return nil, types.NewHTTPStatusError(url, resp.StatusCode, resp.Status)
|
||||
}
|
||||
|
||||
// A declared size above the limit is refused before anything is read.
|
||||
if resp.ContentLength > types.RemoteFetchLimit {
|
||||
return nil, types.NewHTTPFetchError(url, types.ErrRemoteFileTooLarge)
|
||||
}
|
||||
|
||||
data, err := io.ReadAll(io.LimitReader(resp.Body, types.RemoteFetchLimit+1))
|
||||
if err != nil {
|
||||
return nil, types.NewHTTPFetchError(url, err)
|
||||
|
||||
Reference in new issue
Block a user