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
3be3f01d
Commit
3be3f01d
authored
Dec 11, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log nicer
parent
a0ce3ee1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
5 deletions
+9
-5
logging.go
logging.go
+3
-2
proxy.go
proxy.go
+3
-0
sendfile.go
sendfile.go
+1
-1
servefile.go
servefile.go
+2
-2
No files found.
logging.go
View file @
3be3f01d
...
...
@@ -43,9 +43,10 @@ func (l *loggingResponseWriter) WriteHeader(status int) {
}
func
(
l
*
loggingResponseWriter
)
Log
(
r
*
http
.
Request
)
{
fmt
.
Printf
(
"%s %s - - [%s] %q %d %d %q %q
\n
"
,
duration
:=
time
.
Since
(
l
.
started
)
fmt
.
Printf
(
"%s %s - - [%s] %q %d %d %q %q %f
\n
"
,
r
.
Host
,
r
.
RemoteAddr
,
l
.
started
,
fmt
.
Sprintf
(
"%s %s %s"
,
r
.
Method
,
r
.
RequestURI
,
r
.
Proto
),
l
.
status
,
l
.
written
,
r
.
Referer
(),
r
.
UserAgent
(),
l
.
status
,
l
.
written
,
r
.
Referer
(),
r
.
UserAgent
(),
duration
.
Seconds
(),
)
}
proxy.go
View file @
3be3f01d
...
...
@@ -2,6 +2,7 @@ package main
import
(
"bytes"
"fmt"
"io/ioutil"
"net/http"
)
...
...
@@ -20,6 +21,8 @@ func (p *proxyRoundTripper) RoundTrip(r *http.Request) (res *http.Response, err
// instead of 500s we catch the RoundTrip error here and inject a
// 502 response.
if
err
!=
nil
{
logError
(
fmt
.
Errorf
(
"proxyRoundTripper: %s %q failed with: %q"
,
r
.
Method
,
r
.
RequestURI
,
err
))
res
=
&
http
.
Response
{
StatusCode
:
http
.
StatusBadGateway
,
Status
:
http
.
StatusText
(
http
.
StatusBadGateway
),
...
...
sendfile.go
View file @
3be3f01d
...
...
@@ -62,7 +62,7 @@ func (s *sendFileResponseWriter) WriteHeader(status int) {
s
.
hijacked
=
true
// Serve the file
log
.
Printf
(
"Send
File: serving %q"
,
file
)
log
.
Printf
(
"Send
file %q for %s %q"
,
file
,
s
.
req
.
Method
,
s
.
req
.
RequestURI
)
content
,
fi
,
err
:=
openFile
(
file
)
if
err
!=
nil
{
http
.
NotFound
(
s
.
rw
,
s
.
req
)
...
...
servefile.go
View file @
3be3f01d
...
...
@@ -42,7 +42,7 @@ func handleServeFile(documentRoot *string, cache CacheMode, notFoundHandler serv
}
}
// If not found
open the
file
// If not found
, open the original
file
if
content
==
nil
||
err
!=
nil
{
content
,
fi
,
err
=
openFile
(
file
)
}
...
...
@@ -64,7 +64,7 @@ func handleServeFile(documentRoot *string, cache CacheMode, notFoundHandler serv
w
.
Header
()
.
Set
(
"Expires"
,
cacheUntil
)
}
log
.
Printf
(
"S
taticFile: serving %q %q"
,
file
,
w
.
Header
()
.
Get
(
"Content-Encoding"
)
)
log
.
Printf
(
"S
end static file %q (%q) for %s %q"
,
file
,
w
.
Header
()
.
Get
(
"Content-Encoding"
),
r
.
Method
,
r
.
RequestURI
)
http
.
ServeContent
(
w
,
r
.
Request
,
filepath
.
Base
(
file
),
fi
.
ModTime
(),
content
)
}
}
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