upgpkg: wordpress 6.2.1-1
[ArchLinux/community.git] / hey / trunk / 0001-Handle-Request.Host-containing-the-server-port.patch
blob2cce049fbe597d6f00d9ad1966b8c438281abda1
1 From 292dd07ebd79a5236921231d82c85bcb3874f188 Mon Sep 17 00:00:00 2001
2 From: Jelle van der Waa <jelle@vdwaa.nl>
3 Date: Thu, 19 Nov 2020 14:51:31 +0100
4 Subject: [PATCH] Handle Request.Host containing the server port
6 As written in the net/http/#Request documentation Host may be of the
7 form "host:port" and as defined in rfc4366 section-3.1 the serverName
8 should not contain the port or colon.
9 ---
10 requester/requester.go | 8 +++++++-
11 1 file changed, 7 insertions(+), 1 deletion(-)
13 diff --git a/requester/requester.go b/requester/requester.go
14 index fd7277e..924d945 100644
15 --- a/requester/requester.go
16 +++ b/requester/requester.go
17 @@ -20,6 +20,7 @@ import (
18 "crypto/tls"
19 "io"
20 "io/ioutil"
21 + "net"
22 "net/http"
23 "net/http/httptrace"
24 "net/url"
25 @@ -235,10 +236,15 @@ func (b *Work) runWorkers() {
26 var wg sync.WaitGroup
27 wg.Add(b.C)
29 + hostName, _, err := net.SplitHostPort(b.Request.Host);
30 + if err != nil {
31 + hostName = b.Request.Host;
32 + }
34 tr := &http.Transport{
35 TLSClientConfig: &tls.Config{
36 InsecureSkipVerify: true,
37 - ServerName: b.Request.Host,
38 + ServerName: hostName,
40 MaxIdleConnsPerHost: min(b.C, maxIdleConn),
41 DisableCompression: b.DisableCompression,
42 --
43 2.29.2