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
Tatuya Kamada
gitlab-ce
Commits
02afa679
Commit
02afa679
authored
Feb 01, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use only one header to send git blobs
parent
0197549d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
8 deletions
+25
-8
app/controllers/projects/avatars_controller.rb
app/controllers/projects/avatars_controller.rb
+1
-2
app/controllers/projects/raw_controller.rb
app/controllers/projects/raw_controller.rb
+1
-2
lib/api/repositories.rb
lib/api/repositories.rb
+2
-4
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+21
-0
No files found.
app/controllers/projects/avatars_controller.rb
View file @
02afa679
...
@@ -6,8 +6,7 @@ class Projects::AvatarsController < Projects::ApplicationController
...
@@ -6,8 +6,7 @@ class Projects::AvatarsController < Projects::ApplicationController
@blob
=
repository
.
blob_at_branch
(
'master'
,
@project
.
avatar_in_git
)
@blob
=
repository
.
blob_at_branch
(
'master'
,
@project
.
avatar_in_git
)
if
@blob
if
@blob
headers
[
'X-Content-Type-Options'
]
=
'nosniff'
headers
[
'X-Content-Type-Options'
]
=
'nosniff'
headers
[
'Gitlab-Workhorse-Repo-Path'
]
=
repository
.
path_to_repo
headers
.
store
(
*
Gitlab
::
Workhorse
.
send_git_blob
(
repository
,
@blob
))
headers
[
'Gitlab-Workhorse-Send-Blob'
]
=
@blob
.
id
headers
[
'Content-Disposition'
]
=
'inline'
headers
[
'Content-Disposition'
]
=
'inline'
render
nothing:
true
,
content_type:
@blob
.
content_type
render
nothing:
true
,
content_type:
@blob
.
content_type
else
else
...
...
app/controllers/projects/raw_controller.rb
View file @
02afa679
...
@@ -15,8 +15,7 @@ class Projects::RawController < Projects::ApplicationController
...
@@ -15,8 +15,7 @@ class Projects::RawController < Projects::ApplicationController
if
@blob
.
lfs_pointer?
if
@blob
.
lfs_pointer?
send_lfs_object
send_lfs_object
else
else
headers
[
'Gitlab-Workhorse-Repo-Path'
]
=
@repository
.
path_to_repo
headers
.
store
(
*
Gitlab
::
Workhorse
.
send_git_blob
(
@repository
,
@blob
))
headers
[
'Gitlab-Workhorse-Send-Blob'
]
=
@blob
.
id
headers
[
'Content-Disposition'
]
=
'inline'
headers
[
'Content-Disposition'
]
=
'inline'
render
nothing:
true
,
content_type:
get_blob_type
render
nothing:
true
,
content_type:
get_blob_type
end
end
...
...
lib/api/repositories.rb
View file @
02afa679
...
@@ -57,8 +57,7 @@ module API
...
@@ -57,8 +57,7 @@ module API
not_found!
"File"
unless
blob
not_found!
"File"
unless
blob
content_type
'text/plain'
content_type
'text/plain'
header
'Gitlab-Workhorse-Repo-Path'
,
repo
.
path_to_repo
header
*
Gitlab
::
Workhorse
.
send_git_blob
(
repo
,
blob
)
header
'Gitlab-Workhorse-Send-Blob'
,
blob
.
id
end
end
# Get a raw blob contents by blob sha
# Get a raw blob contents by blob sha
...
@@ -84,8 +83,7 @@ module API
...
@@ -84,8 +83,7 @@ module API
env
[
'api.format'
]
=
:txt
env
[
'api.format'
]
=
:txt
content_type
blob
.
mime_type
content_type
blob
.
mime_type
header
'Gitlab-Workhorse-Repo-Path'
,
repo
.
path_to_repo
header
*
Gitlab
::
Workhorse
.
send_git_blob
(
repo
,
blob
)
header
'Gitlab-Workhorse-Send-Blob'
,
blob
.
id
end
end
# Get a an archive of the repository
# Get a an archive of the repository
...
...
lib/gitlab/workhorse.rb
0 → 100644
View file @
02afa679
require
'base64'
require
'json'
module
Gitlab
class
Workhorse
class
<<
self
def
send_git_blob
(
repository
,
blob
)
params_hash
=
{
'RepoPath'
=>
repository
.
path_to_repo
,
'BlobId'
=>
blob
.
id
,
}
params
=
Base64
.
urlsafe_encode64
(
JSON
.
dump
(
params_hash
))
[
'Gitlab-Workhorse-Send-Data'
,
"git-blob:
#{
params
}
"
,
]
end
end
end
end
\ No newline at end of file
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