Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-shell
Commits
932238eb
Commit
932238eb
authored
Jun 07, 2013
by
Akinori MUSHA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ca_file/ca_path configuration options.
parent
5519420e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
config.yml.example
config.yml.example
+2
-0
lib/gitlab_net.rb
lib/gitlab_net.rb
+21
-3
No files found.
config.yml.example
View file @
932238eb
...
...
@@ -7,6 +7,8 @@ gitlab_url: "http://localhost/"
http_settings:
# user: someone
# password: somepass
# ca_file: /etc/ssl/cert.pem
# ca_path: /etc/pki/tls/certs
self_signed_cert: false
# Repositories path
...
...
lib/gitlab_net.rb
View file @
932238eb
...
...
@@ -42,11 +42,15 @@ class GitlabNet
def
get
(
url
)
url
=
URI
.
parse
(
url
)
http
=
Net
::
HTTP
.
new
(
url
.
host
,
url
.
port
)
http
.
use_ssl
=
(
url
.
scheme
==
'https'
)
if
config
.
http_settings
[
'self_signed_cert'
]
&&
http
.
use_ssl?
if
URI
::
HTTPS
===
url
http
.
use_ssl
=
true
http
.
cert_store
=
cert_store
if
config
.
http_settings
[
'self_signed_cert'
]
http
.
verify_mode
=
OpenSSL
::
SSL
::
VERIFY_NONE
end
end
request
=
Net
::
HTTP
::
Get
.
new
(
url
.
request_uri
)
if
config
.
http_settings
[
'user'
]
&&
config
.
http_settings
[
'password'
]
...
...
@@ -55,4 +59,18 @@ class GitlabNet
http
.
start
{
|
http
|
http
.
request
(
request
)
}
end
def
cert_store
@cert_store
||=
OpenSSL
::
X509
::
Store
.
new
.
tap
{
|
store
|
store
.
set_default_paths
if
ca_file
=
config
.
http_settings
[
'ca_file'
]
store
.
add_file
(
ca_file
)
end
if
ca_path
=
config
.
http_settings
[
'ca_path'
]
store
.
add_path
(
ca_path
)
end
}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment