Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: go/util/http.go

Issue 1704713002: Fix issue security issue in Gold (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Fixed poller_test Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ct/go/poller/poller_test.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package util 1 package util
2 2
3 import ( 3 import (
4 "bytes" 4 "bytes"
5 "fmt" 5 "fmt"
6 "io" 6 "io"
7 "io/ioutil" 7 "io/ioutil"
8 "net" 8 "net"
9 "net/http" 9 "net/http"
10 "net/url" 10 "net/url"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return resp, nil 157 return resp, nil
158 } 158 }
159 159
160 // TODO(stephana): Remove 'r' from the argument list since it's not used. It wou ld 160 // TODO(stephana): Remove 'r' from the argument list since it's not used. It wou ld
161 // be also useful if we could specify a return status explicitly. 161 // be also useful if we could specify a return status explicitly.
162 162
163 // ReportError formats an HTTP error response and also logs the detailed error m essage. 163 // ReportError formats an HTTP error response and also logs the detailed error m essage.
164 func ReportError(w http.ResponseWriter, r *http.Request, err error, message stri ng) { 164 func ReportError(w http.ResponseWriter, r *http.Request, err error, message stri ng) {
165 glog.Errorln(message, err) 165 glog.Errorln(message, err)
166 if err != io.ErrClosedPipe { 166 if err != io.ErrClosedPipe {
167 » » http.Error(w, fmt.Sprintf("%s %s", message, err), 500) 167 » » http.Error(w, message, 500)
168 } 168 }
169 } 169 }
170 170
171 // responseProxy implements http.ResponseWriter and records the status codes. 171 // responseProxy implements http.ResponseWriter and records the status codes.
172 type responseProxy struct { 172 type responseProxy struct {
173 http.ResponseWriter 173 http.ResponseWriter
174 wroteHeader bool 174 wroteHeader bool
175 } 175 }
176 176
177 func (rp *responseProxy) WriteHeader(code int) { 177 func (rp *responseProxy) WriteHeader(code int) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 val, err = strconv.Atoi(valStr) 260 val, err = strconv.Atoi(valStr)
261 if err != nil { 261 if err != nil {
262 return 0, fmt.Errorf("Not a valid integer value.") 262 return 0, fmt.Errorf("Not a valid integer value.")
263 } 263 }
264 } 264 }
265 if val < 0 { 265 if val < 0 {
266 return defaultVal, nil 266 return defaultVal, nil
267 } 267 }
268 return val, nil 268 return val, nil
269 } 269 }
OLDNEW
« no previous file with comments | « ct/go/poller/poller_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698