From b4bd037ae15b434a69e7b3c8682713ab12032790 Mon Sep 17 00:00:00 2001 From: snehal ahire Date: Thu, 11 Jun 2026 16:13:54 +0530 Subject: [PATCH] fix(http task): add cookie jar to http.Client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The http task's client was built with Jar == nil, so endpoints that authenticate via a "set a cookie during a redirect, then redirect back" flow (e.g. Amazon Seller Central merchandising/deals APIs) failed with "stopped after 10 redirects". Without a jar, Set-Cookie headers issued mid-redirect were discarded and only the static Cookie header was re-sent, so the required cookie was never present and Amazon kept redirecting to set it — looping until Go's 10-redirect cap. Attach a fresh cookiejar.New(nil) to both http.Client constructions (default getClient and the proxy-override path). Per-task-instance jars keep cookies request-scoped; no cross-task leakage. Refs: DATA-8676 Co-Authored-By: Claude Opus 4.7 (1M context) --- internal/pkg/pipeline/task/http/http.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/pkg/pipeline/task/http/http.go b/internal/pkg/pipeline/task/http/http.go index 33df7e1..41449c8 100644 --- a/internal/pkg/pipeline/task/http/http.go +++ b/internal/pkg/pipeline/task/http/http.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "net/http" + "net/http/cookiejar" "strings" "sync" "time" @@ -94,9 +95,11 @@ func (h *httpCore) getClient() *http.Client { transport := http.DefaultTransport.(*http.Transport).Clone() transport.MaxConnsPerHost = defaultMaxConnsPerHost transport.MaxIdleConnsPerHost = defaultMaxConnsPerHost + jar, _ := cookiejar.New(nil) h.client = &http.Client{ Timeout: time.Duration(h.Timeout), Transport: transport, + Jar: jar, } }) return h.client @@ -320,9 +323,11 @@ func (h *httpCore) call(endpoint string) (*result, error) { } break } + jar, _ := cookiejar.New(nil) client = &http.Client{ Timeout: time.Duration(h.Timeout), Transport: transport, + Jar: jar, } }