Commit graph

217 commits

Author SHA1 Message Date
wjqserver
017bb13295 perf: reuse reverse proxy candidate slices 2026-04-10 06:18:52 +08:00
wjqserver
71a344a3de perf: reuse reverse proxy copy buffers 2026-04-10 06:08:55 +08:00
里見 灯花
efa1e3fb3f
Merge pull request #82 from infinite-iroha/break/v1-redesign-run-api
feat: redesign server startup around Run options
2026-04-07 20:54:47 +08:00
WJQSERVER
7cb777225f
Merge pull request #83 from infinite-iroha/break/v1-redirect-host-strategy
feat: add redirect host selection options
2026-04-07 20:50:09 +08:00
wjqserver
121679b44e fix: preserve IPv6 brackets in redirects
Re-wrap bare IPv6 hosts after stripping ports so HTTPS redirect URLs stay valid. Add a regression test covering bracketed IPv6 hosts in redirect responses.
2026-04-07 20:31:10 +08:00
wjqserver
9e57f5a5f5 fix: stop redirect siblings on shutdown
Make the non-graceful HTTPS redirect path shut down all sibling servers after any server returns, so cleanup stays consistent with the graceful path and partial shutdowns do not leave the redirect listener running.
2026-04-07 20:00:58 +08:00
wjqserver
e2cf08d5dd feat: add redirect host selection options
Support explicit redirect host source selection for HTTP-to-HTTPS redirects with ordered header lookup, fixed host mode, and strict validation. Document the new redirect option relationships and add focused tests for 426 fallback, conflict checks, and non-graceful startup errors.
2026-04-07 19:49:13 +08:00
wjqserver
e4d3eed379 feat: redesign server startup around Run options
Replace the old RunShutdown and RunTLS style entry points with a single Run(opts...) API for v1. Add focused startup semantics tests, keep TLS and graceful shutdown independent, ensure sibling servers are cleaned up on startup failure, and update docs to match the new option-based startup model.
2026-04-07 17:44:55 +08:00
WJQSERVER
fca9bbd3ef
Merge pull request #81 from infinite-iroha/feat/optimize-route-match-hotpath
Feat/optimize route match hotpath
2026-04-07 09:58:10 +08:00
wjqserver
987ea81329 fix: avoid fixed-path miss panic and trim 405 fallback work 2026-04-07 09:57:16 +08:00
wjqserver
fa027347d3 fix: reduce default error response overhead
Encode the built-in 404 and 405 payload with a fixed struct instead of a map so default error pages allocate less on the hot miss path. Add a regression test to keep the JSON shape stable.
2026-04-07 09:35:39 +08:00
wjqserver
57847fa446 fix: avoid unsafe header buffer reuse
Use safe string copies for pooled header buffers and simplify case-insensitive lookup buffering now that the pseudo stack path was ineffective. This addresses review concerns without changing the routing semantics.
2026-04-07 09:32:14 +08:00
wjqserver
2d4aefc86e fix: cut redirect and allow-path routing overhead
Reuse fixed-path and Allow-header buffers so redirect and OPTIONS handling stop rebuilding temporary data on every request. Cache fallback chains and add regression coverage for redirect, 404, 405, and Allow behavior to keep the faster miss paths stable.
2026-04-07 09:06:56 +08:00
wjqserver
5d979e5670 fix: reduce per-request context and fallback overhead
Make Context keys lazy so requests that never call Set stop allocating on reset. Reuse stable 404 and 405 handlers and add focused benchmarks so ServeHTTP miss paths stay measurable.
2026-04-07 08:39:10 +08:00
wjqserver
6acac9edce fix: streamline route matcher backtracking
Avoid rebuilding skipped-node state during wildcard fallback so the matcher no longer loops on the same static branch and stops allocating on the hot path. Add focused route benchmarks and regression coverage to keep the optimized path stable.
2026-04-07 08:27:00 +08:00
WJQSERVER
b1ce4d584e
Merge pull request #80 from infinite-iroha/fix/v1-runshutdown-http-only
fix: keep RunShutdown on HTTP path
2026-04-07 07:53:36 +08:00
wjqserver
7db3d32d7b test: improve serve startup failure diagnostics 2026-04-07 07:51:39 +08:00
wjqserver
d12e887858 fix: keep RunShutdown on HTTP path 2026-04-07 07:46:06 +08:00
WJQSERVER
7f69d5668e
Merge pull request #79 from infinite-iroha/fix/v1-findcaseinsensitivepath-wildchild-order
fix: avoid panic in case-insensitive wildcard lookup
2026-04-07 07:25:28 +08:00
wjqserver
70f8cc6159 fix: avoid panic in case-insensitive wildcard lookup 2026-04-07 07:19:33 +08:00
WJQSERVER
863f984990
Merge pull request #78 from infinite-iroha/break/v1-enhance-reverse-proxy
fix(reverseproxy): bridge websocket extended connect upstreams
2026-04-03 00:42:01 +08:00
wjqserver
1a6325d461 feat: improve reverse proxy tunnel management with sync.Once and better error handling 2026-04-03 00:29:15 +08:00
wjqserver
d53693952a refactor: improve TLS config handling and add bridge connection tests 2026-04-02 22:13:50 +08:00
wjqserver
dcdb1504a3 feat: add robust transport cloning and improve header handling in reverse proxy 2026-04-02 19:58:34 +08:00
wjqserver
20dc6e4047 refactor: cache ResponseController in H2ReadWriteCloser for better performance 2026-04-02 19:44:02 +08:00
wjqserver
7abedc1ace enhance: improve reverse proxy error handling and add tests 2026-04-02 19:33:18 +08:00
wjqserver
50c6a23614 refactor: simplify reverse proxy bridged connection handling by removing unused bufio 2026-04-02 18:50:27 +08:00
wjqserver
a9c1662333 fix(reverseproxy): bridge websocket extended connect upstreams 2026-04-02 18:19:41 +08:00
WJQSERVER
0d7721a24c
Merge pull request #77 from infinite-iroha/break/v1-enhance-reverse-proxy
feat(reverseproxy): add upstream balancing and protocol improvements
2026-04-02 15:32:41 +08:00
wjqserver
919236665b feat(reverseproxy): add upstream balancing and failover 2026-04-02 14:40:56 +08:00
wjqserver
59f190ce3a fix(http2): preserve extended CONNECT tunnel shutdown semantics 2026-04-02 04:09:43 +08:00
wjqserver
2165cc4114 feat(http2): support OPTIONS * and extended CONNECT 2026-04-02 03:53:17 +08:00
wjqserver
ed44c592d3 fix(reverseproxy): align forwarding and tunnel semantics 2026-04-02 03:18:49 +08:00
WJQSERVER
c019f24e99
Merge pull request #76 from infinite-iroha/break/v1-fix-filetext-bodylimit
Break/v1 fix filetext bodylimit
2026-04-01 00:09:30 +08:00
wjqserver
e6ff0fa6b9 fix(maxreader): treat non-positive limits as unlimited 2026-04-01 00:03:23 +08:00
wjqserver
91c50536c4 fix(maxreader): avoid hangs after reaching body limit 2026-03-31 23:37:02 +08:00
wjqserver
85cc9b5cf6 fix(form): align PostForm parsing with body limit handling 2026-03-31 18:59:32 +08:00
wjqserver
64e2ad9e7b Fix FileText status code and unify request body size limits
- FileText: now respects the provided status code instead of defaulting to 200 OK
- Request body limits: prepareRequestBody() is now only called when MaxRequestBodySize > 0
  - ShouldBindJSON, ShouldBindWANF, ShouldBindGOB, ShouldBindForm, GetReqBody, PostForm
    all now use the original c.Request.Body path when no limit is configured
- maxBytesReader: fixed exact-limit boundary case where body size == limit was
  incorrectly rejected
- Added regression tests for FileText status codes and body limit behavior

All existing tests pass, and new tests verify the corrected behavior.
2026-03-31 16:38:04 +08:00
WJQSERVER
ef965f4a6a
Merge pull request #75 from infinite-iroha/break/v1-fix-mergectx
Some checks are pending
Go Test / test (push) Waiting to run
fix: mergedContext.Value 遍历父 contexts 查找值
2026-03-30 16:45:09 +08:00
wjqserver
d90d043811 fix: mergedContext.Value 遍历父 contexts 查找值 2026-03-30 02:21:11 +08:00
WJQSERVER
8dc7d8c136
Merge pull request #74 from infinite-iroha/break/v1-feat-add-samesite
Some checks are pending
Go Test / test (push) Waiting to run
feat(cookie): add SameSite support to SetCookie method
2026-03-30 01:50:43 +08:00
wjqserver
9f210deadf fix(cookie): add warning log when multiple SameSite values provided 2026-03-30 01:42:10 +08:00
wjqserver
7be49b96c8 feat(cookie): add SameSite support to SetCookie method 2026-03-30 01:33:00 +08:00
WJQSERVER
3aa84f5dcf
Merge pull request #73 from infinite-iroha/break/v1-feat-add-buf-methods
feat(render): add buffered variants for JSON/GOB/WANF/HTML
2026-03-30 01:22:21 +08:00
WJQSERVER
fba6fedfc5
Update context.go
Some checks failed
Go Test / test (push) Has been cancelled
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-30 01:17:59 +08:00
WJQSERVER
d0fa14c3c5
Update context.go
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-30 01:17:32 +08:00
wjqserver
45c6d36748 fix(HTMLBuf): return 500 on template error, no content
- Remove fallback to HTML() on template rendering failure
- Return 500 error without writing any content on error
- Only fallback to HTML() when renderer is nil or unsupported type
- Prevents multiple response writes
2026-03-30 01:02:37 +08:00
wjqserver
b4e45610b2 refactor(HTMLBuf): delegate fallback to HTML() method
Reduce code duplication by calling c.HTML() for fallback cases:
- When template rendering fails
- When HTMLRender is not configured
- When HTMLRender is not a *template.Template

This ensures consistent behavior between HTMLBuf and HTML methods.
2026-03-30 00:29:50 +08:00
wjqserver
b09595e745 fix: address PR #73 review feedback
- Remove redundant c.Errorf call in JSONBuf
- Consolidate error wrapping in HTMLBuf to avoid duplicate fmt.Errorf calls
- Keep error handling consistent across all Buf methods
2026-03-29 23:43:29 +08:00
wjqserver
6e33bc48aa fix: simplify error handling in Buf methods
Consolidate error wrapping to avoid redundant fmt.Errorf calls.
Follows PR #73 review feedback.
2026-03-29 18:45:08 +08:00