gin v1.6.0 版本更新介绍
发布日期: 2020-03-22
版本号: v1.6.0
本次更新包含多项重要变更、功能增强及问题修复。主要变更包括:提升路径处理性能,移除对govendor的支持,新增SameSite Cookie标志支持。新增YAML协商支持和FileFromFS功能。修复了Unix Socket处理、JSON序列化换行问题、网络连接接受异常、参数计算错误等多项缺陷。性能优化方面引入零拷贝技术、路径处理代码同步、依赖库升级等措施。文档部分完善了接口说明、修正示例及链接。开发环境方面新增Go 1.14支持,停止维护Go 1.10版本。此次更新由多位贡献者共同完成,包括性能优化、安全加固和代码重构等方面的工作。
更新内容 (中文)
发布说明
重大变更
- 性能优化: 提升添加 RemoveExtraSlash 标志的性能 (#2159)
- 停止支持 govendor (#2148)
- 新增 SameSite Cookie 标志支持 (#1615)
功能特性
- 添加 YAML 协商支持 (#2220)
- 新增 FileFromFS 功能 (#2112)
问题修复
- Unix 套接字处理 (#2280)
- 在上下文 JSON 中使用 json.Marshal 解决换行问题 (#2228) 修复 #2209
- 修复接受传入网络连接的逻辑 (#2216)
- 修复最大参数数量计算错误 (#2166)
- [修复] 允许 DataFromReader 使用空头部 (#2121)
- 为 Context.Keys 映射添加互斥锁保护 (#1391)
优化改进
- 新增日志注入防护措施 (#2277)
- 路由树: 遍历节点值优化 (#2229)
- 路由树: 移除重复赋值 (#2222)
- 依赖升级: go-isatty 和 json-iterator/go (#2215)
- 路径处理: 同步 httprouter 代码 (#2212)
- 使用零拷贝方式转换字符串与字节切片 (#2206)
- 重复使用字节缓存进行 URL 路径清理 (#2179)
- 路由树: 减少 else 语句 (#2177)
- 路由树: 同步 httprouter 更新 (#2173)(#2172)(#2171)
- 路由树: 同步部分 httprouter 代码并减少条件判断 (#2163)
- 使用 HTTP 方法常量 (#2155)
- 升级 go-validator 至 v10 版本 (#2149)
- 重构重定向请求处理 (#1970)
- 新增 nomsgpack 编译标签 (#1852)
文档更新
- 完善路径相关注释 (#2223)
- 更新 README 以适配 SetCookie 方法修改 (#2217)
- 修正拼写错误 (#2202)
- 移除 README 中的失效链接 (#2198)
- 更新 Context.Done()、Context.Deadline() 和 Context.Err() 的文档说明 (#2196)
- 更新 validator 至 v10 版本的文档 (#2190)
- 更新 README 中的 go-validator 至 v10 版本说明 (#2189)
- 更新当前输出示例 (#2188)
- 修复「自定义验证器」示例 (#2186)
- 在 README 中添加项目说明 (#2165)
- 更新 gin v1.5 基准测试文档 (#2153)
- 优化 README.md 表述清晰度 (#2122)
其他变更
- CI 支持 Go 1.14 (#2262)
- 升级依赖版本 (#2231)
- 停止支持 Go 1.10 (#2147)
- 修正 mode.go 文件中的注释 (#2129)
贡献者名单
- @AcoNCodes
- @AstolfoKawaii
- @BradyBromley
- @KaushikNeelichetty
- @anio
- @appleboy
- @develerik
- @fifsky
- @jbampton
- @keob
- @manute
- @mosdeo
- @nikandfor
- @nsiregar
- @panjf2000
- @plsmaop
- @rujews
- @ryanjyoder
- @sapk
- @thinkerou
- @victorcoder
- @vkd
更新内容 (原始)
Release Notes
BREAKING
- chore(performance): Improve performance for adding RemoveExtraSlash flag (#2159)
- drop support govendor (#2148)
- Added support for SameSite cookie flag (#1615)
FEATURES
- add yaml negotitation (#2220)
- FileFromFS (#2112)
BUGFIXES
- Unix Socket Handling (#2280)
- Use json marshall in context json to fix breaking new line issue. Fixes #2209 (#2228)
- fix accept incoming network connections (#2216)
- Fixed a bug in the calculation of the maximum number of parameters (#2166)
- [FIX] allow empty headers on DataFromReader (#2121)
- Add mutex for protect Context.Keys map (#1391)
ENHANCEMENTS
- Add mitigation for log injection (#2277)
- tree: range over nodes values (#2229)
- tree: remove duplicate assignment (#2222)
- chore: upgrade go-isatty and json-iterator/go (#2215)
- path: sync code with httprouter (#2212)
- Use zero-copy approach to convert types between string and byte slice (#2206)
- Reuse bytes when cleaning the URL paths (#2179)
- tree: remove one else statement (#2177)
- tree: sync httprouter update (#2173) (#2172) (#2171)
- tree: sync part httprouter codes and reduce if/else (#2163)
- use http method constant (#2155)
- upgrade go-validator to v10 (#2149)
- Refactor redirect request in gin.go (#1970)
- Add build tag nomsgpack (#1852)
DOCS
- docs(path): improve comments (#2223)
- Renew README to fit the modification of SetCookie method (#2217)
- Fix spelling (#2202)
- Remove broken link from README. (#2198)
- Update docs on Context.Done(), Context.Deadline() and Context.Err() (#2196)
- Update validator to v10 (#2190)
- upgrade go-validator to v10 for README (#2189)
- Update to currently output (#2188)
- Fix “Custom Validators” example (#2186)
- Add project to README (#2165)
- docs(benchmarks): for gin v1.5 (#2153)
- Changed wording for clarity in README.md (#2122)
MISC
- ci support go1.14 (#2262)
- chore: upgrade depend version (#2231)
- Drop support go1.10 (#2147)
- fix comment in
mode.go
(#2129)
Contributors
- @AcoNCodes
- @AstolfoKawaii
- @BradyBromley
- @KaushikNeelichetty
- @anio
- @appleboy
- @develerik
- @fifsky
- @jbampton
- @keob
- @manute
- @mosdeo
- @nikandfor
- @nsiregar
- @panjf2000
- @plsmaop
- @rujews
- @ryanjyoder
- @sapk
- @thinkerou
- @victorcoder
- @vkd