1
0
mirror of https://github.com/labstack/echo.git synced 2026-04-26 21:03:34 +02:00

535 Commits

Author SHA1 Message Date
llyaz 0143b9da1e fix(lint): resolve staticcheck issues and improve code quality (#2941)
* refactor: apply De Morgan’s law to boolean expressions
2026-04-07 14:03:50 +03:00
toim 22e4b71109 Remove legacy IP extraction logic from context.RealIP method and move it to LegacyIPExtractor IP extraction function. 2026-03-31 23:26:41 +03:00
karesansui 3f50cc66c2 Fix rate limiter documentation for default burst value 2026-03-29 22:33:19 +03:00
majianhan ec05bc8507 fix: correct spelling mistakes in comments and field name
Fix multiple typos found across the codebase:

- response.go: rename unexported field "commited" to "committed"
- server.go: fix "addres" to "address" in comment
- middleware/csrf.go: fix "formated" to "formatted" in comment
- middleware/request_logger.go: fix "commited" to "committed" in comment
- echotest/context.go: fix "wil" to "will" in comments
2026-03-12 19:08:07 +02:00
Martti T. a260cf5d7f Merge pull request #2900 from aldas/v5_resolveresponsestatus
Add ResolveResponseStatus function to help middleware/handlers determine HTTP status code and echo.Response
2026-02-14 17:39:44 +02:00
toim 9183f1e809 CSRF: support older token-based CSRF protection handler that want to render token into template 2026-02-14 17:39:00 +02:00
toim 19364e2b12 use ResolveResponseStatus in RequestLogger middleware 2026-02-12 18:49:39 +02:00
toim 48f25a6c16 Fix test reporting different size due Windows / Linux line ending inconsistencies 2026-02-06 15:21:00 +02:00
toim 6c162596b4 Fix directory traversal vulnerability under Windows in Static middleware when default Echo filesytem is used (effectively middleware.StaticConfig{Filesystem: nil}) 2026-02-06 15:03:55 +02:00
toim 88d975a83d Fix directory traversal vulnerability under Windows in Static middleware when default Echo filesytem is used (effectively middleware.StaticConfig{Filesystem: nil}) 2026-02-06 12:27:18 +02:00
toim 26ec148ea7 security (static middleware): fix bowser=true listing all file names from given filesystem root 2026-02-02 19:55:30 +02:00
Cyril Galibern 3205495cc9 Update RateLimiterWithConfig example 2026-01-26 20:09:20 +02:00
toim 096ce41d2a Panic MW: will now return a custom PanicStackError with stack trace when config.DisablePrintStack is set to false. 2026-01-20 12:51:41 +02:00
toim c0ff1d4021 fix failing tests under Windows 2026-01-18 18:14:41 +02:00
toimtoimtoim f071367e3c V5 changes 2026-01-18 18:14:41 +02:00
toimtoimtoim d0f9d1e735 CRSF with Sec-Fetch-Site=same-site falls back to legacy token 2025-12-29 23:39:24 +02:00
toimtoimtoim f3fc61848f CRSF with Sec-Fetch-Site checks 2025-12-29 23:39:24 +02:00
toimtoimtoim 321530d2c2 disable test - returns different error under Windows 2025-12-12 13:10:53 +02:00
toimtoimtoim c8abd9f7db disable flaky test 2025-12-12 13:10:53 +02:00
toimtoimtoim 9fe43f78b8 fix Rate limiter disallows fractional rates 2025-12-12 13:10:53 +02:00
toimtoimtoim 1b5122aaed document things to reduce false positives 2025-12-12 13:10:53 +02:00
toimtoimtoim b70ec6a084 add checks for invalid casts 2025-12-12 13:10:53 +02:00
toimtoimtoim cdcf16d3cf deprecate timeout middleware 2025-12-12 13:10:53 +02:00
toimtoimtoim c9b8b36c9a fix Time-of-Check-Time-of-Use bug in rate limiter 2025-12-12 13:10:53 +02:00
toimtoimtoim 1d63c1c242 licence to test file 2025-12-12 13:10:53 +02:00
toimtoimtoim f7dc94df14 handle errors in body dump middleware 2025-12-12 13:10:53 +02:00
toimtoimtoim 0232b57927 improve logger middleware error value logging 2025-12-12 13:10:53 +02:00
toimtoimtoim e2133320c7 fix goroutine leak in proxy raw mode 2025-12-12 13:10:53 +02:00
toimtoimtoim 88a60e4bac fix data race with errors in proxy raw 2025-12-12 13:10:53 +02:00
Martti T. c12cb08a86 Logger middleware json string escaping and deprecation (#2849)
* Logger middleware should escape string values when outputting JSON
* Add Go license to logger_strings.go
* Deprecate middleware.Logger
2025-12-11 14:39:59 +02:00
kumapower17 53b692c4d4 Ensure proxy connection is closed in proxyRaw function
(#2837)
2025-10-26 19:26:29 +02:00
Vishal Rana 55cb3b625d Optimize realm quoting to happen once during middleware creation
Move strconv.Quote(config.Realm) from per-request execution
to middleware initialization for better performance.

- Pre-compute quoted realm at middleware creation time
- Avoids repeated string operations on every auth failure
- Maintains same behavior with better efficiency

Performance improvement suggested during code review.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 11:48:13 +03:00
Vishal Rana dbd583fa4d Add comprehensive tests for realm quoting behavior
Tests cover:
- Default realm quoting
- Custom realm with spaces
- Special characters (quotes, backslashes)
- Empty realm fallback to default
- Unicode realm support

Addresses review feedback about testing strconv.Quote behavior
in WWW-Authenticate header per RFC 7617 compliance.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 11:48:13 +03:00
Vishal Rana 432a2adf46 Improve BasicAuth middleware: use strings.Cut and RFC compliance
- Replace manual for loop with strings.Cut for credential parsing
- Simplify realm handling to always quote according to RFC 7617
- Improve code readability and maintainability

Fixes #2794

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 11:48:13 +03:00
Vishal Rana 212bfe0071 Fix typo in ContextTimeout middleware comment
Change 'aries' to 'arises' in ErrorHandler comment.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 11:23:09 +03:00
Vishal Rana f1ebc67c56 Enhance Logger Middleware Documentation with Detailed Configuration Examples
Addresses issue #2665 by providing comprehensive documentation for the Logger
middleware including:

**Configuration Examples:**
- Basic usage with default settings
- Custom simple and JSON formats
- Custom time formatting
- Header, query, form, and cookie logging
- File output configuration
- Custom tag functions
- Conditional logging with Skipper
- External logging service integration

**Detailed Tag Reference:**
- Complete list of all available tags (time, request, response, dynamic)
- Clear explanations of each tag's purpose and format
- Examples showing proper usage

**Enhanced Field Documentation:**
- Detailed descriptions for all LoggerConfig fields
- Examples for each configuration option
- Default values and behavior

**Troubleshooting Section:**
- Common issues and solutions
- Performance optimization tips
- Best practices for high-traffic applications

**Function Documentation:**
- Enhanced Logger() and LoggerWithConfig() documentation
- Example outputs and usage patterns

This makes the Logger middleware much more accessible to new users while
providing advanced configuration guidance for experienced developers.

Fixes #2665

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-15 19:27:34 -07:00
Martti T. f24aaff49b Revert "CORS: reject requests with 401 for non-preflight request with not mat…" (#2782)
This reverts commit ee3e129778.
2025-05-22 14:11:54 +03:00
t-ibayashi-safie de44c53a5b Add support for TLS WebSocket proxy (#2762)
* Add support for TLS WebSocket proxy

* support tls to non-tls and non-tls to tls websocket proxy
2025-04-04 11:01:42 +03:00
zhuhaicity ce0b12ae53 chore: fix some typos in comment (#2735)
Signed-off-by: zhuhaicity <zhuhai@52it.net>
2025-01-12 09:28:38 +02:00
Martti T. ee3e129778 CORS: reject requests with 401 for non-preflight request with not matching origin header (#2732) 2025-01-07 22:06:28 +02:00
Steven-Whitehead fe26277781 remove jwt middleware 2024-11-25 22:21:56 +02:00
toimtoimtoim 118c1632f2 CORS middleware should compile allowOrigin regexp at creation. 2024-11-22 11:59:58 +02:00
eolson 5a0b4dd806 clean up field assignments with default values to make test configuration more concise/readable 2024-10-26 15:44:47 +03:00
eolson 03c0236fb3 refactor basic_auth_test to utilize table driven tests 2024-10-26 15:44:47 +03:00
toimtoimtoim d20a6257aa Remove pre Go1.20 support 2024-08-16 09:16:52 +03:00
Martti T e0f2a02e4c proxy middleware should use http proxy for SSE requests (#2624) 2024-04-15 21:12:26 +03:00
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
teslaedison 34717b717d fix some typos (#2603)
Signed-off-by: teslaedison <qingchengqiushuang@gmail.com>
2024-03-06 21:43:59 +02:00