22 Commits

Author SHA1 Message Date
Alex Guerra
2c2546aad6 Fix comments mislabeling the implemented interface 2016-06-14 20:40:54 -05:00
Alex Guerra
7fb5d3b261 Implement io.ReaderFrom on responseWriter
The private ResponseWriter implementation in the stdlib implements this
interface to enable some optimizations around sendfile. The interface is
asserted for in io.Copy, probably the most common way to serve files, so
without this method we are missing out on those optimizations. As we're
only interested in writing the headers and capturing the number of bytes
written, we can just call io.Copy on the wrapped http.ResponseWriter and
it will do the right thing, calling ReadFrom if it's implemented and
doing a regular copy if not.
2016-06-14 20:40:54 -05:00
Manu Mtz-Almeida
8f3047814e Comments + IRoutes + IRouter + unexported AbortIndex 2015-07-02 20:24:54 +02:00
Manu Mtz-Almeida
835f66fdc9 404 not found performance improvements
benchmark            old ns/op     new ns/op     delta
Benchmark404         737           249           -66.21%
Benchmark404Many     2330          454           -80.52%

benchmark            old allocs     new allocs     delta
Benchmark404         3              0              -100.00%
Benchmark404Many     10             0              -100.00%

benchmark            old bytes     new bytes     delta
Benchmark404         115           68            -40.87%
Benchmark404Many     235           57            -75.74%
2015-05-30 14:45:13 +02:00
Manu Mtz-Almeida
59c836e1fa Only emit a warning is the status code changes 2015-05-12 18:31:31 +02:00
Manu Mtz-Almeida
99694bb716 Fixes errors 2015-05-12 15:22:13 +02:00
Manu Mtz-Almeida
c61c547539 More unit tests for ResponseWriter 2015-04-08 15:20:39 +02:00
Manu Mtz-Almeida
598c78297c NoWritten and DefaultStatus must be unexported variables 2015-04-07 18:50:16 +02:00
Manu Mtz-Almeida
34b1d0262e Refactors response_writer.go 2015-03-23 04:45:33 +01:00
Manu Mtz-Almeida
251b73fc70 Fixes #239 bug 2015-03-23 04:45:03 +01:00
Manu Mtz-Almeida
21e53c0db6 Fixes responseWriter.Size()
- "written" boolean is not longer needed
- size is reseted
- addition instead of assignation
2014-09-03 04:25:08 +02:00
Matt Newberry
daedc0bc17 Add response body size to writer interface 2014-09-02 13:17:37 -04:00
Manu Mtz-Almeida
3b079bb6f7 Merge branch 'master' into develop 2014-08-29 19:50:58 +02:00
Manu Mtz-Almeida
8e5397bfa0 Adds in-code license 2014-08-29 19:49:50 +02:00
Manu Mtz-Almeida
8f1bbc6b6a gin.responseWriter implements http.Flusher and http.CloseNotifier 2014-08-26 17:52:58 +02:00
Manu Mtz-Almeida
7a87c5cbd4 Referencing the http.Hijacker interface 2014-08-26 17:50:07 +02:00
olebedev
4a24c47a69 Hijacker interface added 2014-08-25 15:58:43 +04:00
Manu Mtz-Almeida
b3f322c5fc Fixes bug when status code is negative 2014-08-24 04:35:11 +02:00
Manu Mtz-Almeida
e11ff5bacb response_writes uses 200 as default status code. 2014-08-18 19:48:01 +02:00
Manu Mtz-Almeida
dcafad3ced Deferring WriteHeader. Part 1 2014-08-18 05:24:48 +02:00
Manu Mtz-Almeida
48f4914165 Performance improvement
- Reduces number of allocations per context
- Improves CPU cache usage
2014-07-18 00:10:28 +02:00
Manu Mtz-Almeida
d42aa6d868 Fixes wrap around http.ResponseWriter 2014-07-04 00:01:28 +02:00