fhttp/http_server.go
changed.
Showing 1 of 1 files from the diff.
@@ -17,10 +17,8 @@
Loading
17 | 17 | // pprof import to get /debug/pprof endpoints on a mux through SetupPPROF. |
|
18 | 18 | import ( |
|
19 | 19 | "bytes" |
|
20 | - | "errors" |
|
21 | 20 | "flag" |
|
22 | 21 | "fmt" |
|
23 | - | "io" |
|
24 | 22 | "io/ioutil" |
|
25 | 23 | "net" |
|
26 | 24 | "net/http" |
@@ -295,15 +293,19 @@
Loading
295 | 293 | first = false |
|
296 | 294 | } |
|
297 | 295 | } |
|
298 | - | expected := r.ContentLength |
|
299 | - | if expected < 0 { |
|
300 | - | expected = 0 // GET have -1 content length |
|
301 | - | } |
|
302 | - | dataBuffer := make([]byte, expected) |
|
303 | - | numRead, err := r.Body.Read(dataBuffer) |
|
304 | - | log.LogVf("read %d/%d: %v", numRead, expected, err) |
|
305 | - | data := dataBuffer[0:numRead] |
|
306 | - | if err != nil && !errors.Is(err, io.EOF) { |
|
296 | + | data, err := ioutil.ReadAll(r.Body) |
|
297 | + | if err != nil { |
|
298 | + | /* |
|
299 | + | expected := r.ContentLength |
|
300 | + | if expected < 0 { |
|
301 | + | expected = 0 // GET have -1 content length |
|
302 | + | } |
|
303 | + | dataBuffer := make([]byte, expected) |
|
304 | + | numRead, err := r.Body.Read(dataBuffer) |
|
305 | + | log.LogVf("read %d/%d: %v", numRead, expected, err) |
|
306 | + | data := dataBuffer[0:numRead] |
|
307 | + | if err != nil && !errors.Is(err, io.EOF) { |
|
308 | + | */ |
|
307 | 309 | log.Errf("Error reading %v", err) |
|
308 | 310 | http.Error(w, err.Error(), http.StatusInternalServerError) |
|
309 | 311 | return |
@@ -322,9 +324,11 @@
Loading
322 | 324 | if _, err = w.Write(buf.Bytes()); err != nil { |
|
323 | 325 | log.Errf("Error writing response %v to %v", err, r.RemoteAddr) |
|
324 | 326 | } |
|
325 | - | if f, ok := w.(http.Flusher); ok { |
|
326 | - | f.Flush() |
|
327 | - | } |
|
327 | + | /* |
|
328 | + | if f, ok := w.(http.Flusher); ok { |
|
329 | + | f.Flush() |
|
330 | + | } |
|
331 | + | */ |
|
328 | 332 | } |
|
329 | 333 | ||
330 | 334 | // CacheOn sets the header for indefinite caching. |
Files | Coverage |
---|---|
dflag | 82.2% |
fgrpc | 87.3% |
fhttp | 84.2% |
fnet/network.go | 86.9% |
log/logger.go | 86.7% |
periodic/periodic.go | 96.9% |
stats/stats.go | 96.5% |
tcprunner/tcprunner.go | 70.2% |
Project Totals (25 files) | 86.1% |
3478
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.