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
Kazuhiko Shiozaki
gitlab-shell
Commits
a329982d
Commit
a329982d
authored
May 18, 2013
by
ash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log all GETs and responses at :debug.
parent
6a267b32
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
lib/gitlab_net.rb
lib/gitlab_net.rb
+6
-2
No files found.
lib/gitlab_net.rb
View file @
a329982d
...
@@ -3,6 +3,7 @@ require 'openssl'
...
@@ -3,6 +3,7 @@ require 'openssl'
require
'json'
require
'json'
require_relative
'gitlab_config'
require_relative
'gitlab_config'
require_relative
'gitlab_logger'
class
GitlabNet
class
GitlabNet
def
allowed?
(
cmd
,
repo
,
key
,
ref
)
def
allowed?
(
cmd
,
repo
,
key
,
ref
)
...
@@ -13,7 +14,6 @@ class GitlabNet
...
@@ -13,7 +14,6 @@ class GitlabNet
key_id
=
key
.
gsub
(
"key-"
,
""
)
key_id
=
key
.
gsub
(
"key-"
,
""
)
url
=
"
#{
host
}
/allowed?key_id=
#{
key_id
}
&action=
#{
cmd
}
&ref=
#{
ref
}
&project=
#{
project_name
}
"
url
=
"
#{
host
}
/allowed?key_id=
#{
key_id
}
&action=
#{
cmd
}
&ref=
#{
ref
}
&project=
#{
project_name
}
"
resp
=
get
(
url
)
resp
=
get
(
url
)
!!
(
resp
.
code
==
'200'
&&
resp
.
body
==
'true'
)
!!
(
resp
.
code
==
'200'
&&
resp
.
body
==
'true'
)
...
@@ -40,6 +40,8 @@ class GitlabNet
...
@@ -40,6 +40,8 @@ class GitlabNet
end
end
def
get
(
url
)
def
get
(
url
)
$logger
.
debug
"Performing GET
#{
url
}
"
url
=
URI
.
parse
(
url
)
url
=
URI
.
parse
(
url
)
http
=
Net
::
HTTP
.
new
(
url
.
host
,
url
.
port
)
http
=
Net
::
HTTP
.
new
(
url
.
host
,
url
.
port
)
http
.
use_ssl
=
(
url
.
scheme
==
'https'
)
http
.
use_ssl
=
(
url
.
scheme
==
'https'
)
...
@@ -53,6 +55,8 @@ class GitlabNet
...
@@ -53,6 +55,8 @@ class GitlabNet
request
.
basic_auth
config
.
http_settings
[
'user'
],
config
.
http_settings
[
'password'
]
request
.
basic_auth
config
.
http_settings
[
'user'
],
config
.
http_settings
[
'password'
]
end
end
http
.
start
{
|
http
|
http
.
request
(
request
)
}
http
.
start
{
|
http
|
http
.
request
(
request
)
}.
tap
do
|
resp
|
$logger
.
debug
{
"Received response
#{
resp
.
code
}
=>
#{
resp
.
body
}
"
}
end
end
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