diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22e94101..56a1957a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -258,7 +258,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-24.04, ubuntu-24.04-arm] + os: [ubuntu-22.04, ubuntu-22.04-arm] needs: [get-release] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed0061c3..49a27c51 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -69,7 +69,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-latest, macos-latest, ubuntu-24.04, ubuntu-24.04-arm] + os: [windows-latest, macos-latest, ubuntu-22.04, ubuntu-22.04-arm] needs: [test] steps: - uses: actions/checkout@v3 diff --git a/internal/protocol/http/fetcher.go b/internal/protocol/http/fetcher.go index a4b493ad..b3e9035f 100644 --- a/internal/protocol/http/fetcher.go +++ b/internal/protocol/http/fetcher.go @@ -386,19 +386,20 @@ func (f *Fetcher) run(index int, ctx context.Context) (err error) { resp *http.Response ) f.redirectLock.Lock() - if f.redirectURL != "" { + redirectURL := f.redirectURL + if redirectURL != "" { f.redirectLock.Unlock() - } - err = func() (err error) { + } else { + // Only hold the lock when we need to potentially set redirectURL defer func() { - if f.redirectURL == "" { - if err == nil { - f.redirectURL = resp.Request.URL.String() - } - f.redirectLock.Unlock() + if redirectURL == "" && err == nil { + f.redirectURL = resp.Request.URL.String() } + f.redirectLock.Unlock() }() + } + err = func() (err error) { httpReq, err = f.buildRequest(ctx, f.meta.Req) if err != nil { return