2016-02-11 12:10:14 -05:00
|
|
|
module WorkhorseHelpers
|
|
|
|
extend self
|
|
|
|
|
|
|
|
def workhorse_send_data
|
|
|
|
@_workhorse_send_data ||= begin
|
|
|
|
header = response.headers[Gitlab::Workhorse::SEND_DATA_HEADER]
|
|
|
|
split_header = header.split(':')
|
|
|
|
type = split_header.shift
|
|
|
|
header = split_header.join(':')
|
|
|
|
[
|
|
|
|
type,
|
2017-05-03 07:22:03 -04:00
|
|
|
JSON.parse(Base64.urlsafe_decode64(header))
|
2016-02-11 12:10:14 -05:00
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
2016-08-19 13:10:41 -04:00
|
|
|
|
|
|
|
def workhorse_internal_api_request_header
|
|
|
|
jwt_token = JWT.encode({ 'iss' => 'gitlab-workhorse' }, Gitlab::Workhorse.secret, 'HS256')
|
|
|
|
{ 'HTTP_' + Gitlab::Workhorse::INTERNAL_API_REQUEST_HEADER.upcase.tr('-', '_') => jwt_token }
|
|
|
|
end
|
2016-02-17 09:22:33 -05:00
|
|
|
end
|