Skip to content

fix(BAC-700): deep-clone httpClient in Clone() to prevent shared Timeout mutation#9

Merged
knight42 merged 1 commit intov2from
fix/clone-http-client-shared-timeout
Feb 28, 2026
Merged

fix(BAC-700): deep-clone httpClient in Clone() to prevent shared Timeout mutation#9
knight42 merged 1 commit intov2from
fix/clone-http-client-shared-timeout

Conversation

@zhoukuncheng
Copy link
Copy Markdown
Contributor

resty.Clone() did cc := *c which shallow-copies the httpClient pointer, so all clones shared the same *http.Client. Calling SetTimeout() on any clone mutated the shared object and affected every other client.

Fix: value-copy *http.Client in Clone() so each clone gets its own instance.

resty.Clone() did `cc := *c` which shallow-copies the httpClient pointer,
so all clones shared the same *http.Client. Calling SetTimeout() on any
clone mutated the shared object and affected every other client.

Fix: value-copy *http.Client in Clone() so each clone gets its own instance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@knight42 knight42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@knight42 knight42 merged commit 615227e into v2 Feb 28, 2026
4 checks passed
@knight42 knight42 deleted the fix/clone-http-client-shared-timeout branch February 28, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants