Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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-ce
Commits
cc065fbe
Commit
cc065fbe
authored
Mar 12, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support Golang subpackage fetching
Closes #13805
parent
f7da99ae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
CHANGELOG
CHANGELOG
+1
-0
config/initializers/go_get.rb
config/initializers/go_get.rb
+1
-0
lib/gitlab/middleware/go.rb
lib/gitlab/middleware/go.rb
+51
-0
No files found.
CHANGELOG
View file @
cc065fbe
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 8.6.0 (unreleased)
v 8.6.0 (unreleased)
- Support Golang subpackage fetching (Stan Hu)
- Contributions to forked projects are included in calendar
- Contributions to forked projects are included in calendar
- Improve the formatting for the user page bio (Connor Shea)
- Improve the formatting for the user page bio (Connor Shea)
- Removed the default password from the initial admin account created during
- Removed the default password from the initial admin account created during
...
...
config/initializers/go_get.rb
0 → 100644
View file @
cc065fbe
Rails
.
application
.
config
.
middleware
.
use
(
Gitlab
::
Middleware
::
Go
)
lib/gitlab/middleware/go.rb
0 → 100644
View file @
cc065fbe
# A dumb middleware that returns a Go HTML document if the go-get=1 query string
# is used irrespective if the namespace/project exists
module
Gitlab
module
Middleware
class
Go
def
initialize
(
app
)
@app
=
app
end
def
call
(
env
)
request
=
Rack
::
Request
.
new
(
env
)
if
go_request?
(
request
)
render_go_doc
(
request
)
else
@app
.
call
(
env
)
end
end
private
def
render_go_doc
(
request
)
body
=
go_body
(
request
)
response
=
Rack
::
Response
.
new
(
body
,
200
,
{
'Content-Type'
=>
'text/html'
})
response
.
finish
end
def
go_request?
(
request
)
return
request
[
"go-get"
].
to_i
==
1
end
def
go_body
(
request
)
base_url
=
Settings
.
gitlab
[
'url'
]
# Go subpackages may be in the form of namespace/project/path1/path2/../pathN
# We can just ignore the paths and leave the namespace/project
path_info
=
request
.
env
[
"PATH_INFO"
]
path_info
.
sub!
(
/^\//
,
''
)
project_path
=
path_info
.
split
(
'/'
).
first
(
2
).
join
(
'/'
)
request_url
=
URI
.
join
(
base_url
,
project_path
)
domain_path
=
strip_url
(
request_url
.
to_s
)
"<!DOCTYPE html><html><head><meta content='
#{
domain_path
}
git
#{
request_url
}
.git' name='go-import'></head></html>
\n
"
;
end
def
strip_url
(
url
)
url
.
gsub
(
'http://'
,
''
).
gsub
(
'https://'
,
''
)
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