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
1
Merge Requests
1
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
nexedi
gitlab-workhorse
Commits
6fca6fbb
Commit
6fca6fbb
authored
Mar 01, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use request entity too large and proxy request in case of error
parent
c0cde5db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
internal/builds/register.go
internal/builds/register.go
+2
-2
internal/helper/helpers.go
internal/helper/helpers.go
+6
-0
No files found.
internal/builds/register.go
View file @
6fca6fbb
...
...
@@ -95,7 +95,7 @@ func RegisterHandler(h http.Handler, watchHandler WatchKeyHandler, pollingDurati
requestBody
,
err
:=
readRunnerBody
(
w
,
r
)
if
err
!=
nil
{
registerHandlerHits
.
WithLabelValues
(
"body-read-error"
)
.
Inc
()
helper
.
Fail500
(
w
,
r
,
&
largeBodyError
{
err
})
helper
.
RequestEntityTooLarge
(
w
,
r
,
&
largeBodyError
{
err
})
return
}
...
...
@@ -118,7 +118,7 @@ func RegisterHandler(h http.Handler, watchHandler WatchKeyHandler, pollingDurati
runnerRequest
.
LastUpdate
,
pollingDuration
)
if
err
!=
nil
{
registerHandlerHits
.
WithLabelValues
(
"watch-error"
)
.
Inc
()
helper
.
Fail500
(
w
,
newRequest
,
&
watchError
{
err
}
)
proxyRegisterRequest
(
h
,
w
,
newRequest
)
return
}
...
...
internal/helper/helpers.go
View file @
6fca6fbb
...
...
@@ -41,6 +41,12 @@ func TooManyRequests(w http.ResponseWriter, r *http.Request, err error) {
printError
(
r
,
err
)
}
func
RequestEntityTooLarge
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
err
error
)
{
http
.
Error
(
w
,
"Request Entity Too Large"
,
http
.
StatusRequestEntityTooLarge
)
captureRavenError
(
r
,
err
)
printError
(
r
,
err
)
}
func
printError
(
r
*
http
.
Request
,
err
error
)
{
if
r
!=
nil
{
log
.
Printf
(
"error: %s %q: %v"
,
r
.
Method
,
r
.
RequestURI
,
err
)
...
...
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