diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2017-01-03 11:08:25 +0100 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2017-01-03 11:42:41 +0100 |
commit | 3695d162bd68827dbd495cca77db366f81b5893b (patch) | |
tree | 67f2a2dd350750f246a368d36b11bc8107c9c8a2 /lib | |
parent | a3712cc18de8283b25c3a8a034ecc8c9b7feca48 (diff) | |
download | gitlab-shell-3695d162bd68827dbd495cca77db366f81b5893b.tar.gz |
Set a 'Host' header on unix sockets
Workaround for a bug in the HTTPUNIX client.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab_net.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb index 8488adc..e06557c 100644 --- a/lib/gitlab_net.rb +++ b/lib/gitlab_net.rb @@ -159,6 +159,12 @@ class GitlabNet request.set_form_data(params.merge(secret_token: secret_token)) + if uri.is_a?(URI::HTTPUNIX) + # The HTTPUNIX HTTP client does not set a correct Host header. This can + # lead to 400 Bad Request responses. + request['Host'] = 'localhost' + end + request end |