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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-workhorse
Commits
a79e5928
Commit
a79e5928
authored
Dec 04, 2015
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d9899658
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 addition
and
16 deletions
+1
-16
archive.go
archive.go
+0
-1
authorization.go
authorization.go
+0
-11
git-http.go
git-http.go
+0
-2
upstream.go
upstream.go
+1
-1
xsendfile.go
xsendfile.go
+0
-1
No files found.
archive.go
View file @
a79e5928
/*
In this file we handle 'git archive' downloads
NOTE
*/
package
main
...
...
authorization.go
View file @
a79e5928
// NOTE
package
main
import
(
"encoding/json"
"errors"
"io"
"log"
"net/http"
"strings"
)
func
preAuthorizeHandler
(
handleFunc
serviceHandleFunc
,
suffix
string
)
serviceHandleFunc
{
return
func
(
w
http
.
ResponseWriter
,
r
*
gitRequest
)
{
//Tstart := time.Now()
//log.Printf("AUTH1")
authReq
,
err
:=
r
.
u
.
newUpstreamRequest
(
r
.
Request
,
nil
,
suffix
)
if
err
!=
nil
{
fail500
(
w
,
"newUpstreamRequest"
,
err
)
...
...
@@ -65,19 +61,12 @@ func preAuthorizeHandler(handleFunc serviceHandleFunc, suffix string) serviceHan
}
}
//Tendauth := time.Now()
handleFunc
(
w
,
r
)
//Tend := time.Now()
//log.Printf("Tauth:\t%s", Tendauth.Sub(Tstart))
//log.Printf("Tauth+handle:\t%s", Tend.Sub(Tstart))
}
}
func
repoPreAuthorizeHandler
(
handleFunc
serviceHandleFunc
)
serviceHandleFunc
{
return
preAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
gitRequest
)
{
log
.
Printf
(
"AUTH2"
)
if
r
.
RepoPath
==
""
{
fail500
(
w
,
"repoPreAuthorizeHandler"
,
errors
.
New
(
"missing authorization response"
))
return
...
...
git-http.go
View file @
a79e5928
...
...
@@ -7,14 +7,12 @@ package main
import
(
"fmt"
"io"
"log"
"net/http"
"path/filepath"
"strings"
)
func
handleGetInfoRefs
(
w
http
.
ResponseWriter
,
r
*
gitRequest
)
{
log
.
Printf
(
"HELLO WORLD"
)
rpc
:=
r
.
URL
.
Query
()
.
Get
(
"service"
)
if
!
(
rpc
==
"git-upload-pack"
||
rpc
==
"git-receive-pack"
)
{
// The 'dumb' Git HTTP protocol is not supported
...
...
upstream.go
View file @
a79e5928
...
...
@@ -66,6 +66,7 @@ type gitRequest struct {
// Routing table
var
gitServices
=
[
...
]
gitService
{
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/raw/.+\z`
),
handleGetBlobRaw
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/info/refs\z`
),
repoPreAuthorizeHandler
(
handleGetInfoRefs
)},
gitService
{
"POST"
,
regexp
.
MustCompile
(
`/git-upload-pack\z`
),
repoPreAuthorizeHandler
(
contentEncodingHandler
(
handlePostRPC
))},
gitService
{
"POST"
,
regexp
.
MustCompile
(
`/git-receive-pack\z`
),
repoPreAuthorizeHandler
(
contentEncodingHandler
(
handlePostRPC
))},
...
...
@@ -74,7 +75,6 @@ var gitServices = [...]gitService{
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar\z`
),
repoPreAuthorizeHandler
(
handleGetArchive
)},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar.gz\z`
),
repoPreAuthorizeHandler
(
handleGetArchive
)},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar.bz2\z`
),
repoPreAuthorizeHandler
(
handleGetArchive
)},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/raw/.+\z`
),
handleGetBlobRaw
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/uploads/`
),
handleSendFile
},
// Git LFS
...
...
xsendfile.go
View file @
a79e5928
...
...
@@ -13,7 +13,6 @@ import (
"os"
)
// NOTE
func
handleSendFile
(
w
http
.
ResponseWriter
,
r
*
gitRequest
)
{
upRequest
,
err
:=
r
.
u
.
newUpstreamRequest
(
r
.
Request
,
r
.
Body
,
""
)
if
err
!=
nil
{
...
...
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