Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthik Nayak <knayak@gitlab.com>2022-09-26 23:34:08 +0300
committerKarthik Nayak <knayak@gitlab.com>2022-09-27 15:15:51 +0300
commitc117a47bd58c89c5255ff2bdeaedfd10aadbf741 (patch)
tree437f05516787719d50098c628b58fc9ebf5ffa40
parentf2069c55d7fbb2637fa9f49c8985ab1119039ad1 (diff)
git: remove addition of Host header4266-custom-dns-resolve
In commands which are adding the host header, we are now replacing it with a specific flag `http.curloptResolve`. So let's remove the unwanted/extra `Host` header.
-rw-r--r--internal/gitaly/service/remote/find_remote_root_ref.go5
-rw-r--r--internal/gitaly/service/remote/update_remote_mirror.go5
-rw-r--r--internal/gitaly/service/repository/create_repository_from_url.go5
-rw-r--r--internal/gitaly/service/repository/create_repository_from_url_test.go6
-rw-r--r--internal/gitaly/service/repository/fetch_remote.go5
5 files changed, 2 insertions, 24 deletions
diff --git a/internal/gitaly/service/remote/find_remote_root_ref.go b/internal/gitaly/service/remote/find_remote_root_ref.go
index 103345377..92de8e0ce 100644
--- a/internal/gitaly/service/remote/find_remote_root_ref.go
+++ b/internal/gitaly/service/remote/find_remote_root_ref.go
@@ -27,11 +27,6 @@ func (s *server) findRemoteRootRef(ctx context.Context, request *gitalypb.FindRe
})
}
if host := request.GetHttpHost(); host != "" {
- config = append(config, git.ConfigPair{
- Key: fmt.Sprintf("http.%s.extraHeader", request.RemoteUrl),
- Value: "Host: " + host,
- })
-
configPair, err := git.GetCurloptResolveConfig(request.RemoteUrl, host)
// ignore the error since this only works for http/https
if err == nil {
diff --git a/internal/gitaly/service/remote/update_remote_mirror.go b/internal/gitaly/service/remote/update_remote_mirror.go
index 4dfc60430..8c41918a3 100644
--- a/internal/gitaly/service/remote/update_remote_mirror.go
+++ b/internal/gitaly/service/remote/update_remote_mirror.go
@@ -82,11 +82,6 @@ func (s *server) updateRemoteMirror(stream gitalypb.RemoteService_UpdateRemoteMi
})
}
if host := remote.GetHttpHost(); host != "" {
- remoteConfig = append(remoteConfig, git.ConfigPair{
- Key: fmt.Sprintf("http.%s.extraHeader", remote.GetUrl()),
- Value: "Host: " + host,
- })
-
configPair, err := git.GetCurloptResolveConfig(remote.GetUrl(), host)
// ignore the error since this only works for http/https
if err == nil {
diff --git a/internal/gitaly/service/repository/create_repository_from_url.go b/internal/gitaly/service/repository/create_repository_from_url.go
index c7dc5e9b1..c9b141095 100644
--- a/internal/gitaly/service/repository/create_repository_from_url.go
+++ b/internal/gitaly/service/repository/create_repository_from_url.go
@@ -56,11 +56,6 @@ func (s *server) cloneFromURLCommand(
}
if repoHost != "" {
- config = append(config, git.ConfigPair{
- Key: "http.extraHeader",
- Value: "Host: " + repoHost,
- })
-
configPair, err := git.GetCurloptResolveConfig(repoURL, repoHost)
// ignore the error since this only works for http/https
if err == nil {
diff --git a/internal/gitaly/service/repository/create_repository_from_url_test.go b/internal/gitaly/service/repository/create_repository_from_url_test.go
index b9526cad9..84bc0075e 100644
--- a/internal/gitaly/service/repository/create_repository_from_url_test.go
+++ b/internal/gitaly/service/repository/create_repository_from_url_test.go
@@ -285,10 +285,8 @@ func TestServer_CloneFromURLCommand(t *testing.T) {
require.Subset(t, cmd.Env(), []string{
"GIT_CONFIG_KEY_0=http.extraHeader",
"GIT_CONFIG_VALUE_0=" + tc.expectedAuthHeader,
- "GIT_CONFIG_KEY_1=http.extraHeader",
- "GIT_CONFIG_VALUE_1=Host: www.example.com",
- "GIT_CONFIG_KEY_2=http.curloptResolve",
- "GIT_CONFIG_VALUE_2=www.example.com:443:192.0.2.1",
+ "GIT_CONFIG_KEY_1=http.curloptResolve",
+ "GIT_CONFIG_VALUE_1=www.example.com:443:192.0.2.1",
})
})
}
diff --git a/internal/gitaly/service/repository/fetch_remote.go b/internal/gitaly/service/repository/fetch_remote.go
index 025468ed9..3a0e8ca52 100644
--- a/internal/gitaly/service/repository/fetch_remote.go
+++ b/internal/gitaly/service/repository/fetch_remote.go
@@ -59,11 +59,6 @@ func (s *server) FetchRemote(ctx context.Context, req *gitalypb.FetchRemoteReque
})
}
if host := req.GetRemoteParams().GetHttpHost(); host != "" {
- config = append(config, git.ConfigPair{
- Key: fmt.Sprintf("http.%s.extraHeader", remoteURL),
- Value: "Host: " + host,
- })
-
configPair, err := git.GetCurloptResolveConfig(remoteURL, host)
// ignore the error since this only works for http/https
if err == nil {