buger / goreplay

GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.
https://goreplay.org
Other
18.53k stars 13 forks source link

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

Closed byte0o closed 2 years ago

byte0o commented 2 years ago

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

CLAassistant commented 2 years ago

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[bot] commented 2 years ago

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 commented 2 years ago

Makes sense! Thanks a lot!


Latest forum discussions: