Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix sets multiple --output-http parameters to take effect only one #1097

Merged
merged 1 commit into from
Jul 23, 2022

Conversation

byte0o
Copy link
Contributor

@byte0o byte0o commented Jul 9, 2022

This function is called when the outhttp plugin is registered in the loop, passing a pointer type to &Settings.OutputHTTPConfig
https://github.com/buger/goreplay/blob/master/plugins.go#L145
for _, options := range Settings.OutputHTTP { plugins.registerPlugin(NewHTTPOutput, options, &Settings.OutputHTTPConfig) }

parsing the address to generate the url directly overrides the &Settings.OutputHTTPConfig.url field,which will cause multiple calls to overwrite the same &Settings.OutputHTTPConfig.url field
https://github.com/buger/goreplay/blob/master/output_http.go#L71
config.url, err = url.Parse(address)

Multiple HTTPOutputs point to the same &Settings.OutputHTTPConfig, resulting in the last --output-http parameter value overwriting the previously set value.
https://github.com/buger/goreplay/blob/master/output_http.go#L106
o.config = config

@@ -48,6 +48,24 @@ type HTTPOutputConfig struct {
url *url.URL
}

func (hoc *HTTPOutputConfig) Copy() *HTTPOutputConfig {
Copy link
Collaborator

Choose a reason for hiding this comment

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

exported method HTTPOutputConfig.Copy should have comment or be unexported

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sonarcloud
Copy link

sonarcloud bot commented Jul 9, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@buger
Copy link
Owner

buger commented Jul 23, 2022

Makes sense!
Thanks a lot!


Latest forum discussions:

@buger buger merged commit 752b457 into buger:master Jul 23, 2022
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.

4 participants