summaryrefslogtreecommitdiff
path: root/lgc
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2022-12-12 10:02:04 -0500
committerWill Hawkins <[email protected]>2022-12-12 10:02:04 -0500
commit3c59340e315d860f1c39d3d41e808770d0b91697 (patch)
treeb3469bf22d769e1d57b777c57a14c6c9e0a2f4e4 /lgc
parentd0432fdf26e91a6d91534b450112492aabe3a896 (diff)
[Feature] Add support for test_endpoint
When a test_endpoint is returned in the config for a test, all requests will be sent to that host but the :authority pseudo header (nee: Host: message header) will contain the host specified in the various `_url` fields of the config data.
Diffstat (limited to 'lgc')
-rw-r--r--lgc/lgc.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/lgc/lgc.go b/lgc/lgc.go
index bb39a31..bbab5ad 100644
--- a/lgc/lgc.go
+++ b/lgc/lgc.go
@@ -57,6 +57,7 @@ type LoadGeneratingConnectionDownload struct {
downloaded uint64
lastIntervalEnd int64
Path string
+ Host string
downloadStartTime time.Time
lastDownloaded uint64
client *http.Client
@@ -316,6 +317,17 @@ func (lgd *LoadGeneratingConnectionDownload) doDownload(ctx context.Context) {
return
}
+ // To support test_endpoint
+ if len(lgd.Host) != 0 {
+ if debug.IsDebug(lgd.debug) {
+ fmt.Printf(
+ "Because of a test_endpoint in the config, there is a special Host set for this connection: %s\n",
+ lgd.Host,
+ )
+ }
+ request.Host = lgd.Host
+ }
+
// Used to disable compression
request.Header.Set("Accept-Encoding", "identity")
@@ -347,6 +359,7 @@ type LoadGeneratingConnectionUpload struct {
uploaded uint64
lastIntervalEnd int64
Path string
+ Host string
uploadStartTime time.Time
lastUploaded uint64
client *http.Client
@@ -411,6 +424,17 @@ func (lgu *LoadGeneratingConnectionUpload) doUpload(ctx context.Context) bool {
return false
}
+ // To support test_endpoint
+ if len(lgu.Host) != 0 {
+ if debug.IsDebug(lgu.debug) {
+ fmt.Printf(
+ "Because of a test_endpoint in the config, there is a special Host set for this connection: %s\n",
+ lgu.Host,
+ )
+ }
+ request.Host = lgu.Host
+ }
+
// Used to disable compression
request.Header.Set("Accept-Encoding", "identity")