set request.ContentLength
This informs the HTTP client the content length is known and disables chunked Transfer-Encoding
This commit is contained in:
parent
3ee85f1c6c
commit
daa4f096f9
1 changed files with 9 additions and 0 deletions
|
@ -1442,6 +1442,15 @@ func makeRequest(ctx context.Context, method string, requestURL *url.URL, header
|
|||
|
||||
req.Header.Set("User-Agent", fmt.Sprintf("ollama/%s (%s %s) Go/%s", version.Version, runtime.GOARCH, runtime.GOOS, runtime.Version()))
|
||||
|
||||
if s := req.Header.Get("Content-Length"); s != "" {
|
||||
contentLength, err := strconv.ParseInt(s, 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req.ContentLength = contentLength
|
||||
}
|
||||
|
||||
client := &http.Client{
|
||||
CheckRedirect: func(req *http.Request, via []*http.Request) error {
|
||||
if len(via) >= 10 {
|
||||
|
|
Loading…
Reference in a new issue