Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
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
1
Merge Requests
1
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-workhorse
Commits
d40a5a8f
Commit
d40a5a8f
authored
Jul 27, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use an early return in git_handler (less nesting)
parent
0c7758a2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
42 deletions
+50
-42
main.go
main.go
+50
-42
No files found.
main.go
View file @
d40a5a8f
...
...
@@ -68,12 +68,25 @@ func main() {
func
git_handler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
var
gl_id
string
var
path_match
[]
string
var
g
gitService
var
found_service
bool
log
.
Print
(
r
.
Method
,
" "
,
r
.
URL
)
for
_
,
g
:=
range
git_services
{
path_match
:=
g
.
regexp
.
FindStringSubmatch
(
r
.
URL
.
Path
)
// Look for a matching Git service
for
_
,
g
=
range
git_services
{
path_match
=
g
.
regexp
.
FindStringSubmatch
(
r
.
URL
.
Path
)
if
r
.
Method
==
g
.
method
&&
path_match
!=
nil
{
found_service
=
true
break
}
}
if
!
found_service
{
http
.
Error
(
w
,
"Not Found"
,
404
)
return
}
// Ask the auth backend if the request is allowed, and what the
// user ID (GL_ID) is.
auth_response
,
err
:=
do_auth_request
(
r
)
...
...
@@ -111,11 +124,6 @@ func git_handler(w http.ResponseWriter, r *http.Request) {
}
g
.
handle_func
(
gl_id
,
g
.
rpc
,
path
.
Join
(
repo_root
,
found_path
),
w
,
r
)
return
}
}
http
.
Error
(
w
,
"Not Found"
,
404
)
return
}
func
valid_path
(
p
string
)
bool
{
...
...
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