1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-18 16:20:53 +02:00
Commit Graph

71 Commits

Author SHA1 Message Date
Martti T
3598f295f9
Change type definition blocks to single declarations. This helps copy/pasting Echo code in examples. (#2606) 2024-03-09 07:53:07 -08:00
Martti T
a842444e8f
Add SPDX licence comments to files. See https://spdx.dev/learn/handling-license-info/ (#2604) 2024-03-09 11:21:24 +02:00
Martti T
bc1e1904f1
Allow ResponseWriters to unwrap writers when flushing/hijacking (#2595)
* Allow ResponseWriters to unwrap writers when flushing/hijacking
2024-03-09 10:50:47 +02:00
toimtoimtoim
130be07425 fix gzip not sending response code for no content responses (404, 301/302 redirects etc) 2023-07-16 20:35:09 +03:00
Ingo Oppermann
42f07ed880
gzip response only if it exceeds a minimal length (#2267)
* gzip response only if it exceeds a minimal length

If the response is too short, e.g. a few bytes, compressing the
response makes it even larger. The new parameter MinLength to the
GzipConfig struct allows to set a threshold (in bytes) as of which
response size the compression should be applied. If the response
is shorter, no compression will be applied.
2023-05-31 08:53:33 +03:00
zeek
3c4d3b3083 Replace "io/ioutil"
"io/ioutil" pakcage has been deprecated since Go 1.16.
2022-11-21 15:59:14 +02:00
Nao Yonashiro
7bde9aea06
Fixed a problem that returned wrong content-encoding when the gzip compressed content was empty (#1921)
Fixed a problem that returned wrong content-encoding when the gzip compressed content was empty
2021-12-15 10:15:13 +02:00
Pablo Andres Fuente
14e020bc07 Adding sync.Pool to Decompress middleware
Fixing a http.Request.Body leak on the decompress middleware that were
not properly Close
Removing the defer on the call to gzip.Reader, because that reader is
already exausted after the call to io.Copy
2020-11-27 03:01:04 +00:00
Pablo Andres Fuente
ac54e132e4 Adding sync.Pool to Compress Middleware
Adding a sync.Pool for the *gzip.Writer reduces the allocations of the
Compress middleware in 50% and gives an increase on execution speed of
a 85%
This fix #1643
2020-11-07 03:52:35 +00:00
Shinnosuke Sawada
8dd25c39ce
make gzipResponseWriter implement http.Pusher (#1615) 2020-08-03 17:58:08 -07:00
Hylke Visser
69bd47b35f Fix flushing in Gzip middleware (#1317)
* Make Gzip response Writer also call Flush of underlying Writer
* Add unit test for chunked responses with Gzip
2019-04-16 15:52:06 -05:00
Alex Ungur
6d9e043284 Introduced Go module support as v4, removed obsolete CloseNotifier() mechanism
This reintroduces support for Go modules, as v4.

CloseNotifier() is removed as it has been obsoleted, see https://golang.org/doc/go1.11#net/http

It was already NOT working (not sending signals) as of 1.11 the functionality was gone, we merely
deleted the functions that exposed it. If anyone still relies on it they should migrate to using
`c.Request().Context().Done()` instead.

Closes #1268, #1255
2019-01-30 16:11:42 +02:00
Vishal Rana
da083ffd0a Implemented rewrite middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-12-28 11:26:50 -08:00
Vishal Rana
17c4df3e77 Fixed #444, closed #964
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-06-28 10:05:09 -07:00
Vishal Rana
9016770066 Fixed #873
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-03-10 16:10:07 -08:00
Vishal Rana
7140e8395a Using _fixture for testing
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-02-14 14:11:10 -08:00
Edward Muller
998c5de65f Set the Content-Encoding header only when requested
Also if the Size == 0 unset the Content-Encoding header
2017-02-14 10:10:04 -08:00
Edward Muller
6f90742dec Set the Content-Encoding header earlier for Static
Static uses ServeContent, which looks to see if the Content-Encoding
header is set or not to determine if it should set the Content-Length.

If Content-Length is set by something it will be wrong after the gzip
compression happens and stricter routers (and tools like curl) will
have problems with the request.

Fixes #806
2017-02-13 19:12:58 -08:00
Vishal Rana
52fa135fd5 Updated docs, exposed middleware.DefaultSkipper
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-01-28 11:46:43 -08:00
Vishal Rana
869cdcd19a Dropped Response#Writer/SetWriter functions
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-21 18:56:35 -08:00
Vishal Rana
d9a6052c67 Closes #489, Closes #781, Updated docs
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-20 23:13:46 -08:00
Vishal Rana
562021ed2d fixed #781
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-20 13:58:45 -08:00
Vishal Rana
cd36c4f813 fixed https://github.com/labstack/armor/issues/13
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-31 16:08:53 -07:00
Vishal Rana
2aec0353f5 First commit to v3, #665
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-09-22 22:56:00 -07:00
Vishal Rana
3d9d408365 Options for redirect middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-08-31 20:10:14 -07:00
Vishal Rana
27f9b326b8 Ability to skip a middleware via callback
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-07-27 09:34:44 -07:00
Vishal Rana
c6b32d5541 Added json tags to middleware config
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-05-18 18:53:54 -07:00
Vishal Rana
98dd8bf9e9 Added CSRF middleware, #341.
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-05-12 17:45:00 -07:00
Vishal Rana
1afaa6ec0b Updated docs, changes to static middleware config
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-05-10 11:52:04 -07:00
Vishal Rana
be825e0229 Refactored variable names
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-24 10:22:15 -07:00
Vishal Rana
1247552c9b Fixed https://github.com/labstack/echox/issues/9
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-20 07:32:51 -07:00
Vishal Rana
1a7bc677da API changes from to with
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-07 21:20:50 -07:00
Vishal Rana
8b5772cf65 Proper header and MIME constants
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-06 07:29:47 -07:00
Vishal Rana
adad28012c Default bool config as false for middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-05 18:57:57 -07:00
Vishal Rana
b5d6c05101 Fixed #441, #294
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-02 14:24:51 -07:00
Vishal Rana
be5148ae27 Gzip fix #437
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-01 15:44:09 -07:00
Vishal Rana
1113413441 Defaults for middleware config
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-31 16:30:19 -07:00
Vishal Rana
3a67c062de Updated godoc
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-23 23:05:01 -05:00
Vishal Rana
b47abdb9ec Fixed #424, #427
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-20 08:14:55 -07:00
Vishal Rana
576dfeb71d Close gzip writer
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-19 16:17:43 -07:00
Vishal Rana
c4caeb8ffb more godoc
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-19 15:47:20 -07:00
Vishal Rana
e159f4d7ef Making Echo#Pre actually work.
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-17 13:24:52 -07:00
Vishal Rana
00bf0d651f Enhanced recover middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-14 16:14:33 -07:00
Vishal Rana
082814c776 Fixed #387
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-12 05:14:15 -08:00
Vishal Rana
25e72d623e Fixed recover and gzip middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-10 16:35:20 -08:00
Vishal Rana
8ee864ae08 Dropped Engine**#Object functions
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-10 12:05:33 -08:00
Vishal Rana
19d51dad4c Static as middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-18 22:50:40 -08:00
Vishal Rana
c0873843ad Option to options
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-18 07:00:51 -08:00
Vishal Rana
88f307bedd Middleware and handler as closure
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-17 21:49:31 -08:00
Vishal Rana
c9a62e20b4 Middleware as structs
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-17 21:18:46 -08:00