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
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
iv
gitlab-workhorse
Commits
ff480401
Commit
ff480401
authored
Apr 04, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'use-gopath' into 'master'
Be compatible with GOPATH See merge request !43
parents
b04210fe
fece6a3b
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
123 additions
and
80 deletions
+123
-80
.gitignore
.gitignore
+1
-0
Makefile
Makefile
+22
-11
authorization_test.go
authorization_test.go
+4
-3
cmd/gitlab-zip-cat/main.go
cmd/gitlab-zip-cat/main.go
+2
-1
cmd/gitlab-zip-metadata/main.go
cmd/gitlab-zip-metadata/main.go
+2
-1
internal/api/api.go
internal/api/api.go
+3
-2
internal/artifacts/artifact_download.go
internal/artifacts/artifact_download.go
+4
-3
internal/artifacts/artifact_download_test.go
internal/artifacts/artifact_download_test.go
+4
-3
internal/artifacts/artifacts_upload.go
internal/artifacts/artifacts_upload.go
+5
-4
internal/artifacts/artifacts_upload_test.go
internal/artifacts/artifacts_upload_test.go
+6
-5
internal/badgateway/roundtripper.go
internal/badgateway/roundtripper.go
+2
-1
internal/git/archive.go
internal/git/archive.go
+3
-2
internal/git/blob.go
internal/git/blob.go
+3
-2
internal/git/git-http.go
internal/git/git-http.go
+4
-3
internal/lfs/lfs.go
internal/lfs/lfs.go
+3
-2
internal/proxy/proxy.go
internal/proxy/proxy.go
+3
-2
internal/sendfile/sendfile.go
internal/sendfile/sendfile.go
+2
-1
internal/staticpages/deploy_page.go
internal/staticpages/deploy_page.go
+2
-1
internal/staticpages/deploy_page_test.go
internal/staticpages/deploy_page_test.go
+2
-1
internal/staticpages/error_pages.go
internal/staticpages/error_pages.go
+2
-1
internal/staticpages/error_pages_test.go
internal/staticpages/error_pages_test.go
+2
-1
internal/staticpages/servefile.go
internal/staticpages/servefile.go
+3
-2
internal/staticpages/servefile_test.go
internal/staticpages/servefile_test.go
+2
-1
internal/upload/uploads.go
internal/upload/uploads.go
+2
-1
internal/upload/uploads_test.go
internal/upload/uploads_test.go
+4
-3
internal/upstream/development_test.go
internal/upstream/development_test.go
+2
-1
internal/upstream/handlers.go
internal/upstream/handlers.go
+2
-1
internal/upstream/handlers_test.go
internal/upstream/handlers_test.go
+2
-1
internal/upstream/routes.go
internal/upstream/routes.go
+9
-8
internal/upstream/upstream.go
internal/upstream/upstream.go
+4
-3
main.go
main.go
+2
-1
main_test.go
main_test.go
+5
-4
proxy_test.go
proxy_test.go
+5
-4
No files found.
.gitignore
View file @
ff480401
...
@@ -4,3 +4,4 @@ testdata/scratch
...
@@ -4,3 +4,4 @@ testdata/scratch
testdata/public
testdata/public
gitlab-zip-cat
gitlab-zip-cat
gitlab-zip-metadata
gitlab-zip-metadata
_build
Makefile
View file @
ff480401
PREFIX
=
/usr/local
PREFIX
=
/usr/local
VERSION
=
$(
shell
git describe
)
-
$(
shell
date
-u
+%Y%m%d.%H%M%S
)
VERSION
=
$(
shell
git describe
)
-
$(
shell
date
-u
+%Y%m%d.%H%M%S
)
export
GOPATH
=
$(
shell
pwd
)
/_build
GOBUILD
=
go build
-ldflags
"-X main.Version=
${VERSION}
"
GOBUILD
=
go build
-ldflags
"-X main.Version=
${VERSION}
"
PKG
=
gitlab.com/gitlab-org/gitlab-workhorse
all
:
gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse
all
:
clean-build
gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse
gitlab-zip-cat
:
$(shell find cmd/gitlab-zip-cat/ -name '*.go')
gitlab-zip-cat
:
_build
$(shell find cmd/gitlab-zip-cat/ -name '*.go')
${GOBUILD}
-o
$@
.
/cmd/
$@
${GOBUILD}
-o
$@
${PKG}
/cmd/
$@
gitlab-zip-metadata
:
$(shell find cmd/gitlab-zip-metadata/ -name '*.go')
gitlab-zip-metadata
:
_build
$(shell find cmd/gitlab-zip-metadata/ -name '*.go')
${GOBUILD}
-o
$@
.
/cmd/
$@
${GOBUILD}
-o
$@
${PKG}
/cmd/
$@
gitlab-workhorse
:
$(shell find . -name '*.go
')
gitlab-workhorse
:
_build $(shell find . -name '*.go' | grep -v '^
\.
/_
')
${GOBUILD}
-o
$@
${GOBUILD}
-o
$@
${PKG}
install
:
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
install
:
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
mkdir
-p
$(DESTDIR)${PREFIX}
/bin/
mkdir
-p
$(DESTDIR)${PREFIX}
/bin/
install
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
${DESTDIR}${PREFIX}
/bin/
install
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
${DESTDIR}${PREFIX}
/bin/
_build
:
mkdir
-p
$@
/src/
${PKG}
tar
-cf
-
--exclude
$@
--exclude
.git
.
|
(
cd
$@
/src/
${PKG}
&&
tar
-xf
-
)
touch
$@
.PHONY
:
test
.PHONY
:
test
test
:
testdata/data/group/test.git clean-workhorse all
test
:
testdata/data/group/test.git clean-
build clean-
workhorse all
go
fmt
.
/... |
awk
'{ print } END { if (NR > 0) { print "Please run go fmt"; exit 1 } }'
go
fmt
${PKG}
/... |
awk
'{ print } END { if (NR > 0) { print "Please run go fmt"; exit 1 } }'
support/path go
test
.
/...
support/path go
test
${PKG}
/...
@
echo
SUCCESS
@
echo
SUCCESS
coverage
:
testdata/data/group/test.git
coverage
:
testdata/data/group/test.git
...
@@ -38,9 +45,13 @@ testdata/data:
...
@@ -38,9 +45,13 @@ testdata/data:
mkdir
-p
$@
mkdir
-p
$@
.PHONY
:
clean
.PHONY
:
clean
clean
:
clean-workhorse
clean
:
clean-workhorse
clean-build
rm
-rf
testdata/data testdata/scratch
rm
-rf
testdata/data testdata/scratch
.PHONY
:
clean-workhorse
.PHONY
:
clean-workhorse
clean-workhorse
:
clean-workhorse
:
rm
-f
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
rm
-f
gitlab-workhorse gitlab-zip-cat gitlab-zip-metadata
.PHONY
:
clean-build
clean-build
:
rm
-rf
_build
authorization_test.go
View file @
ff480401
package
main
package
main
import
(
import
(
"./internal/api"
"./internal/helper"
"./internal/testhelper"
"fmt"
"fmt"
"net/http"
"net/http"
"net/http/httptest"
"net/http/httptest"
"regexp"
"regexp"
"testing"
"testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
)
)
func
okHandler
(
w
http
.
ResponseWriter
,
_
*
http
.
Request
,
_
*
api
.
Response
)
{
func
okHandler
(
w
http
.
ResponseWriter
,
_
*
http
.
Request
,
_
*
api
.
Response
)
{
...
...
cmd/gitlab-zip-cat/main.go
View file @
ff480401
package
main
package
main
import
(
import
(
"../../internal/zipartifacts"
"archive/zip"
"archive/zip"
"flag"
"flag"
"fmt"
"fmt"
"io"
"io"
"os"
"os"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
)
)
const
progName
=
"gitlab-zip-cat"
const
progName
=
"gitlab-zip-cat"
...
...
cmd/gitlab-zip-metadata/main.go
View file @
ff480401
package
main
package
main
import
(
import
(
"../../internal/zipartifacts"
"flag"
"flag"
"fmt"
"fmt"
"os"
"os"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
)
)
const
progName
=
"gitlab-zip-metadata"
const
progName
=
"gitlab-zip-metadata"
...
...
internal/api/api.go
View file @
ff480401
package
api
package
api
import
(
import
(
"../badgateway"
"../helper"
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"io"
"io"
...
@@ -10,6 +8,9 @@ import (
...
@@ -10,6 +8,9 @@ import (
"net/http"
"net/http"
"net/url"
"net/url"
"strings"
"strings"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
)
)
type
API
struct
{
type
API
struct
{
...
...
internal/artifacts/artifact_download.go
View file @
ff480401
package
artifacts
package
artifacts
import
(
import
(
"../api"
"../helper"
"../zipartifacts"
"bufio"
"bufio"
"errors"
"errors"
"fmt"
"fmt"
...
@@ -15,6 +12,10 @@ import (
...
@@ -15,6 +12,10 @@ import (
"path/filepath"
"path/filepath"
"strings"
"strings"
"syscall"
"syscall"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
)
)
func
detectFileContentType
(
fileName
string
)
string
{
func
detectFileContentType
(
fileName
string
)
string
{
...
...
internal/artifacts/artifact_download_test.go
View file @
ff480401
package
artifacts
package
artifacts
import
(
import
(
"../api"
"../helper"
"../testhelper"
"archive/zip"
"archive/zip"
"encoding/base64"
"encoding/base64"
"encoding/json"
"encoding/json"
...
@@ -13,6 +10,10 @@ import (
...
@@ -13,6 +10,10 @@ import (
"net/http/httptest"
"net/http/httptest"
"os"
"os"
"testing"
"testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
)
)
func
testArtifactDownloadServer
(
t
*
testing
.
T
,
archive
string
,
entry
string
)
*
httptest
.
Server
{
func
testArtifactDownloadServer
(
t
*
testing
.
T
,
archive
string
,
entry
string
)
*
httptest
.
Server
{
...
...
internal/artifacts/artifacts_upload.go
View file @
ff480401
package
artifacts
package
artifacts
import
(
import
(
"../api"
"../helper"
"../upload"
"../zipartifacts"
"errors"
"errors"
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
...
@@ -13,6 +9,11 @@ import (
...
@@ -13,6 +9,11 @@ import (
"os"
"os"
"os/exec"
"os/exec"
"syscall"
"syscall"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/upload"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
)
)
type
artifactsUploadProcessor
struct
{
type
artifactsUploadProcessor
struct
{
...
...
internal/artifacts/artifacts_upload_test.go
View file @
ff480401
package
artifacts
package
artifacts
import
(
import
(
"../api"
"../helper"
"../proxy"
"../testhelper"
"../zipartifacts"
"archive/zip"
"archive/zip"
"bytes"
"bytes"
"compress/gzip"
"compress/gzip"
...
@@ -18,6 +13,12 @@ import (
...
@@ -18,6 +13,12 @@ import (
"net/http/httptest"
"net/http/httptest"
"os"
"os"
"testing"
"testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/zipartifacts"
)
)
func
testArtifactsUploadServer
(
t
*
testing
.
T
,
tempPath
string
)
*
httptest
.
Server
{
func
testArtifactsUploadServer
(
t
*
testing
.
T
,
tempPath
string
)
*
httptest
.
Server
{
...
...
internal/badgateway/roundtripper.go
View file @
ff480401
package
badgateway
package
badgateway
import
(
import
(
"../helper"
"bytes"
"bytes"
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
"net"
"net"
"net/http"
"net/http"
"time"
"time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
)
)
// Values from http.DefaultTransport
// Values from http.DefaultTransport
...
...
internal/git/archive.go
View file @
ff480401
...
@@ -5,8 +5,6 @@ In this file we handle 'git archive' downloads
...
@@ -5,8 +5,6 @@ In this file we handle 'git archive' downloads
package
git
package
git
import
(
import
(
"../helper"
"../senddata"
"fmt"
"fmt"
"io"
"io"
"io/ioutil"
"io/ioutil"
...
@@ -18,6 +16,9 @@ import (
...
@@ -18,6 +16,9 @@ import (
"path/filepath"
"path/filepath"
"syscall"
"syscall"
"time"
"time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata"
)
)
type
archive
struct
{
senddata
.
Prefix
}
type
archive
struct
{
senddata
.
Prefix
}
...
...
internal/git/blob.go
View file @
ff480401
package
git
package
git
import
(
import
(
"../helper"
"../senddata"
"fmt"
"fmt"
"io"
"io"
"log"
"log"
"net/http"
"net/http"
"strings"
"strings"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata"
)
)
type
blob
struct
{
senddata
.
Prefix
}
type
blob
struct
{
senddata
.
Prefix
}
...
...
internal/git/git-http.go
View file @
ff480401
...
@@ -5,9 +5,6 @@ In this file we handle the Git 'smart HTTP' protocol
...
@@ -5,9 +5,6 @@ In this file we handle the Git 'smart HTTP' protocol
package
git
package
git
import
(
import
(
"../api"
"../delay"
"../helper"
"errors"
"errors"
"fmt"
"fmt"
"io"
"io"
...
@@ -17,6 +14,10 @@ import (
...
@@ -17,6 +14,10 @@ import (
"path"
"path"
"path/filepath"
"path/filepath"
"strings"
"strings"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/delay"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
)
)
func
GetInfoRefs
(
a
*
api
.
API
)
http
.
Handler
{
func
GetInfoRefs
(
a
*
api
.
API
)
http
.
Handler
{
...
...
internal/lfs/lfs.go
View file @
ff480401
...
@@ -5,8 +5,6 @@ In this file we handle git lfs objects downloads and uploads
...
@@ -5,8 +5,6 @@ In this file we handle git lfs objects downloads and uploads
package
lfs
package
lfs
import
(
import
(
"../api"
"../helper"
"bytes"
"bytes"
"crypto/sha256"
"crypto/sha256"
"encoding/hex"
"encoding/hex"
...
@@ -17,6 +15,9 @@ import (
...
@@ -17,6 +15,9 @@ import (
"net/http"
"net/http"
"os"
"os"
"path/filepath"
"path/filepath"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
)
)
func
PutStore
(
a
*
api
.
API
,
h
http
.
Handler
)
http
.
Handler
{
func
PutStore
(
a
*
api
.
API
,
h
http
.
Handler
)
http
.
Handler
{
...
...
internal/proxy/proxy.go
View file @
ff480401
package
proxy
package
proxy
import
(
import
(
"../badgateway"
"../helper"
"net/http"
"net/http"
"net/http/httputil"
"net/http/httputil"
"net/url"
"net/url"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
)
)
type
Proxy
struct
{
type
Proxy
struct
{
...
...
internal/sendfile/sendfile.go
View file @
ff480401
...
@@ -7,9 +7,10 @@ via the X-Sendfile mechanism. All that is needed in the Rails code is the
...
@@ -7,9 +7,10 @@ via the X-Sendfile mechanism. All that is needed in the Rails code is the
package
sendfile
package
sendfile
import
(
import
(
"../helper"
"log"
"log"
"net/http"
"net/http"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
)
)
const
sendFileResponseHeader
=
"X-Sendfile"
const
sendFileResponseHeader
=
"X-Sendfile"
...
...
internal/staticpages/deploy_page.go
View file @
ff480401
package
staticpages
package
staticpages
import
(
import
(
"../helper"
"io/ioutil"
"io/ioutil"
"net/http"
"net/http"
"path/filepath"
"path/filepath"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
)
)
func
(
s
*
Static
)
DeployPage
(
handler
http
.
Handler
)
http
.
Handler
{
func
(
s
*
Static
)
DeployPage
(
handler
http
.
Handler
)
http
.
Handler
{
...
...
internal/staticpages/deploy_page_test.go
View file @
ff480401
package
staticpages
package
staticpages
import
(
import
(
"../testhelper"
"io/ioutil"
"io/ioutil"
"net/http"
"net/http"
"net/http/httptest"
"net/http/httptest"
"os"
"os"
"path/filepath"
"path/filepath"
"testing"
"testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
)
)
func
TestIfNoDeployPageExist
(
t
*
testing
.
T
)
{
func
TestIfNoDeployPageExist
(
t
*
testing
.
T
)
{
...
...
internal/staticpages/error_pages.go
View file @
ff480401
package
staticpages
package
staticpages
import
(
import
(
"../helper"
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
"log"
"log"
"net/http"
"net/http"
"path/filepath"
"path/filepath"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
)
)
type
errorPageResponseWriter
struct
{
type
errorPageResponseWriter
struct
{
...
...
internal/staticpages/error_pages_test.go
View file @
ff480401
package
staticpages
package
staticpages
import
(
import
(
"../testhelper"
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
"net/http"
"net/http"
...
@@ -9,6 +8,8 @@ import (
...
@@ -9,6 +8,8 @@ import (
"os"
"os"
"path/filepath"
"path/filepath"
"testing"
"testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
)
)
func
TestIfErrorPageIsPresented
(
t
*
testing
.
T
)
{
func
TestIfErrorPageIsPresented
(
t
*
testing
.
T
)
{
...
...
internal/staticpages/servefile.go
View file @
ff480401
package
staticpages
package
staticpages
import
(
import
(
"../helper"
"../urlprefix"
"log"
"log"
"net/http"
"net/http"
"os"
"os"
"path/filepath"
"path/filepath"
"strings"
"strings"
"time"
"time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/urlprefix"
)
)
type
CacheMode
int
type
CacheMode
int
...
...
internal/staticpages/servefile_test.go
View file @
ff480401
package
staticpages
package
staticpages
import
(
import
(
"../testhelper"
"bytes"
"bytes"
"compress/gzip"
"compress/gzip"
"io/ioutil"
"io/ioutil"
...
@@ -10,6 +9,8 @@ import (
...
@@ -10,6 +9,8 @@ import (
"os"
"os"
"path/filepath"
"path/filepath"
"testing"
"testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
)
)
func
TestServingNonExistingFile
(
t
*
testing
.
T
)
{
func
TestServingNonExistingFile
(
t
*
testing
.
T
)
{
...
...
internal/upload/uploads.go
View file @
ff480401
package
upload
package
upload
import
(
import
(
"../helper"
"bytes"
"bytes"
"fmt"
"fmt"
"io"
"io"
...
@@ -9,6 +8,8 @@ import (
...
@@ -9,6 +8,8 @@ import (
"mime/multipart"
"mime/multipart"
"net/http"
"net/http"
"os"
"os"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
)
)
type
MultipartFormProcessor
interface
{
type
MultipartFormProcessor
interface
{
...
...
internal/upload/uploads_test.go
View file @
ff480401
package
upload
package
upload
import
(
import
(
"../helper"
"../proxy"
"../testhelper"
"bytes"
"bytes"
"errors"
"errors"
"fmt"
"fmt"
...
@@ -16,6 +13,10 @@ import (
...
@@ -16,6 +13,10 @@ import (
"regexp"
"regexp"
"strings"
"strings"
"testing"
"testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
)
)
var
nilHandler
=
http
.
HandlerFunc
(
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
{})
var
nilHandler
=
http
.
HandlerFunc
(
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
{})
...
...
internal/upstream/development_test.go
View file @
ff480401
package
upstream
package
upstream
import
(
import
(
"../testhelper"
"net/http"
"net/http"
"net/http/httptest"
"net/http/httptest"
"testing"
"testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
)
)
func
TestDevelopmentModeEnabled
(
t
*
testing
.
T
)
{
func
TestDevelopmentModeEnabled
(
t
*
testing
.
T
)
{
...
...
internal/upstream/handlers.go
View file @
ff480401
package
upstream
package
upstream
import
(
import
(
"../helper"
"compress/gzip"
"compress/gzip"
"fmt"
"fmt"
"io"
"io"
"net/http"
"net/http"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
)
)
func
contentEncodingHandler
(
h
http
.
Handler
)
http
.
Handler
{
func
contentEncodingHandler
(
h
http
.
Handler
)
http
.
Handler
{
...
...
internal/upstream/handlers_test.go
View file @
ff480401
package
upstream
package
upstream
import
(
import
(
"../testhelper"
"bytes"
"bytes"
"compress/gzip"
"compress/gzip"
"fmt"
"fmt"
...
@@ -10,6 +9,8 @@ import (
...
@@ -10,6 +9,8 @@ import (
"net/http/httptest"
"net/http/httptest"
"reflect"
"reflect"
"testing"
"testing"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
)
)
func
TestGzipEncoding
(
t
*
testing
.
T
)
{
func
TestGzipEncoding
(
t
*
testing
.
T
)
{
...
...
internal/upstream/routes.go
View file @
ff480401
package
upstream
package
upstream
import
(
import
(
apipkg
"../api"
"../artifacts"
"../git"
"../lfs"
proxypkg
"../proxy"
"../senddata"
"../sendfile"
"../staticpages"
"net/http"
"net/http"
"regexp"
"regexp"
apipkg
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/artifacts"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/git"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/lfs"
proxypkg
"gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/sendfile"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/staticpages"
)
)
type
route
struct
{
type
route
struct
{
...
...
internal/upstream/upstream.go
View file @
ff480401
...
@@ -7,14 +7,15 @@ In this file we handle request routing and interaction with the authBackend.
...
@@ -7,14 +7,15 @@ In this file we handle request routing and interaction with the authBackend.
package
upstream
package
upstream
import
(
import
(
"../badgateway"
"../helper"
"../urlprefix"
"fmt"
"fmt"
"net/http"
"net/http"
"net/url"
"net/url"
"strings"
"strings"
"time"
"time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/urlprefix"
)
)
var
DefaultBackend
=
helper
.
URLMustParse
(
"http://localhost:8080"
)
var
DefaultBackend
=
helper
.
URLMustParse
(
"http://localhost:8080"
)
...
...
main.go
View file @
ff480401
...
@@ -14,7 +14,6 @@ In this file we start the web server and hand off to the upstream type.
...
@@ -14,7 +14,6 @@ In this file we start the web server and hand off to the upstream type.
package
main
package
main
import
(
import
(
"./internal/upstream"
"flag"
"flag"
"fmt"
"fmt"
"log"
"log"
...
@@ -24,6 +23,8 @@ import (
...
@@ -24,6 +23,8 @@ import (
"os"
"os"
"syscall"
"syscall"
"time"
"time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream"
)
)
// Current version of GitLab Workhorse
// Current version of GitLab Workhorse
...
...
main_test.go
View file @
ff480401
package
main
package
main
import
(
import
(
"./internal/api"
"./internal/helper"
"./internal/testhelper"
"./internal/upstream"
"bytes"
"bytes"
"encoding/base64"
"encoding/base64"
"encoding/json"
"encoding/json"
...
@@ -22,6 +18,11 @@ import (
...
@@ -22,6 +18,11 @@ import (
"strings"
"strings"
"testing"
"testing"
"time"
"time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/upstream"
)
)
const
scratchDir
=
"testdata/scratch"
const
scratchDir
=
"testdata/scratch"
...
...
proxy_test.go
View file @
ff480401
package
main
package
main
import
(
import
(
"./internal/badgateway"
"./internal/helper"
"./internal/proxy"
"./internal/testhelper"
"bytes"
"bytes"
"fmt"
"fmt"
"io"
"io"
...
@@ -14,6 +10,11 @@ import (
...
@@ -14,6 +10,11 @@ import (
"regexp"
"regexp"
"testing"
"testing"
"time"
"time"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/testhelper"
)
)
func
newProxy
(
url
string
,
rt
*
badgateway
.
RoundTripper
)
*
proxy
.
Proxy
{
func
newProxy
(
url
string
,
rt
*
badgateway
.
RoundTripper
)
*
proxy
.
Proxy
{
...
...
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