2 Commits

Author SHA1 Message Date
xfy
b5c3c0954f fix: address repository review issues
Some checks failed
CI / Test (push) Failing after 23s
CI / Build (push) Has been skipped
Security:
- Enforce client_max_body_size in HTTP/2 and HTTP/3 adapters before buffering
- Use trusted-proxy-aware client IP extraction for access control and rate limiting
- Include Host and Vary headers in proxy cache key to prevent cache poisoning
- Harden static file path traversal check with filepath.Clean + prefix validation
- Honor proxy_ssl config for WebSocket upstream TLS

Proxy/handler bugs:
- Decrement WebSocket connection count immediately on return (not deferred in retry loop)
- Remove ineffective headersPool
- Coalesce concurrent background cache refreshes with singleflight

Dev/build:
- Fix Makefile run and test-config targets
- Remove broken wget healthcheck from docker-compose
- Add missing integration build tags
- Fix go vet warnings in tests

CI:
- Run golangci-lint and integration tests in Gitea Actions

Refs: docs/superpowers/plans/2026-06-17-fix-review-issues.md
2026-06-17 11:17:53 +08:00
xfy
d6ee721bc8 test(adapter): 为 adapter 包添加完整单元测试(覆盖率 0% → 预计 >80%)
添加 internal/adapter/common_test.go,覆盖 CommonAdapter 的所有公开方法:

- TestDefaultBodyThreshold: 验证 DefaultBodyThreshold 常量值
- TestNewCommonAdapter: 验证构造函数返回非空实例及 CtxPool 初始化
- TestResetContext: 验证请求/响应/用户值状态重置
- TestResetContext_DisableNormalizing: 验证头部规范化禁用
- TestStreamRequestBody: 表驱动测试覆盖 nil body、NoBody、空体、
  小体(≤64KB)、阈值体、大体(>64KB)、未知长度
- TestStreamRequestBody_ReadError: 读取错误不 panic
- TestStreamRequestBody_PartialReadError: 部分读取错误时保留已读数据
- TestGetContext/PutContext: Pool 获取/归还正确性
- TestGetContext_PutAndGet: 完整的 get-put-get 循环
- TestConcurrentPoolAccess: 100 goroutine 并发安全
- TestConcurrentStreamRequestBody: 50 goroutine 并发流式读取
2026-06-04 08:13:25 +08:00