Commit d64c1a61 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Rename handleFunc type to httpHandleFunc

parent e783a3d0
......@@ -4,7 +4,7 @@ import (
"net/http"
)
func (u *upstream) artifactsAuthorizeHandler(h handleFunc) handleFunc {
func (u *upstream) artifactsAuthorizeHandler(h httpHandleFunc) httpHandleFunc {
return u.preAuthorizeHandler(func(w http.ResponseWriter, r *gitRequest) {
req := r.Request
req.Header.Set(tempPathHeader, r.TempPath)
......
......@@ -51,7 +51,7 @@ func (u *upstream) newUpstreamRequest(r *http.Request, body io.Reader, suffix st
return authReq, nil
}
func (u *upstream) preAuthorizeHandler(h serviceHandleFunc, suffix string) handleFunc {
func (u *upstream) preAuthorizeHandler(h serviceHandleFunc, suffix string) httpHandleFunc {
return func(w http.ResponseWriter, r *http.Request) {
authReq, err := u.newUpstreamRequest(r, nil, suffix)
if err != nil {
......
......@@ -6,7 +6,7 @@ import (
"path/filepath"
)
func handleDeployPage(documentRoot *string, handler handleFunc) handleFunc {
func handleDeployPage(documentRoot *string, handler httpHandleFunc) httpHandleFunc {
return func(w http.ResponseWriter, r *http.Request) {
deployPage := filepath.Join(*documentRoot, "index.html")
data, err := ioutil.ReadFile(deployPage)
......
......@@ -2,7 +2,7 @@ package main
import "net/http"
func handleDevelopmentMode(developmentMode *bool, handler handleFunc) handleFunc {
func handleDevelopmentMode(developmentMode *bool, handler httpHandleFunc) httpHandleFunc {
return func(w http.ResponseWriter, r *http.Request) {
if !*developmentMode {
http.NotFound(w, r)
......
......@@ -59,7 +59,7 @@ func (s *errorPageResponseWriter) Flush() {
s.WriteHeader(http.StatusOK)
}
func handleRailsError(documentRoot *string, handler handleFunc) handleFunc {
func handleRailsError(documentRoot *string, handler httpHandleFunc) httpHandleFunc {
return func(w http.ResponseWriter, r *http.Request) {
rw := errorPageResponseWriter{
rw: w,
......
......@@ -26,7 +26,7 @@ func looksLikeRepo(p string) bool {
return true
}
func (u *upstream) repoPreAuthorizeHandler(handleFunc serviceHandleFunc) handleFunc {
func (u *upstream) repoPreAuthorizeHandler(handleFunc serviceHandleFunc) httpHandleFunc {
return u.preAuthorizeHandler(func(w http.ResponseWriter, r *gitRequest) {
if r.RepoPath == "" {
fail500(w, errors.New("repoPreAuthorizeHandler: RepoPath empty"))
......
......@@ -7,7 +7,7 @@ import (
"net/http"
)
func contentEncodingHandler(h handleFunc) handleFunc {
func contentEncodingHandler(h httpHandleFunc) httpHandleFunc {
return func(w http.ResponseWriter, r *http.Request) {
var body io.ReadCloser
var err error
......
......@@ -17,7 +17,7 @@ import (
"path/filepath"
)
func (u *upstream) lfsAuthorizeHandler(handleFunc serviceHandleFunc) handleFunc {
func (u *upstream) lfsAuthorizeHandler(handleFunc serviceHandleFunc) httpHandleFunc {
return u.preAuthorizeHandler(func(w http.ResponseWriter, r *gitRequest) {
if r.StoreLFSPath == "" {
......
......@@ -43,10 +43,10 @@ var developmentMode = flag.Bool("developmentMode", false, "Allow to serve assets
type httpRoute struct {
method string
regex *regexp.Regexp
handleFunc handleFunc
handleFunc httpHandleFunc
}
type handleFunc func(http.ResponseWriter, *http.Request)
type httpHandleFunc func(http.ResponseWriter, *http.Request)
const projectPattern = `^/[^/]+/[^/]+/`
const gitProjectPattern = `^/[^/]+/[^/]+\.git/`
......
......@@ -16,7 +16,7 @@ const (
CacheExpireMax
)
func (u *upstream) handleServeFile(documentRoot *string, cache CacheMode, notFoundHandler handleFunc) handleFunc {
func (u *upstream) handleServeFile(documentRoot *string, cache CacheMode, notFoundHandler httpHandleFunc) httpHandleFunc {
return func(w http.ResponseWriter, r *http.Request) {
file := filepath.Join(*documentRoot, u.relativeURIPath(cleanURIPath(r.URL.Path)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment