Hijack before WriteHeader to avoid issues with middleware and Gin
- 主要语言
- Go
- 星标
- 5.5k
- 派生
- 372
- PR 合并指标
- 30 天内没有已合并 PR
描述
I tried to upgrade to your library in one of my projects [msgbus](https://git.mills.io/prologic/msgbus) in [this commit](https://git.mills.io/prologic/msgbus/commit/ec8dbec63232c1c78881a19a18e11f4dd9b63935) but unfortunately ran into [some issues](https://git.mills.io/prologic/msgbus/commit/ec8dbec63232c1c78881a19a18e11f4dd9b63935) and had to [revert](https://git.mills.io/prologic/msgbus/commit/6a840a26b42c9c8986502e6b3c7fa5a17700c6a7)
It would appear that the interaction between Logging and GZIP MIddleware is not playing nicely, whereas the old `gorilla/websocket` library was handling this fine.
Basic error I'm seeing is:
```
2022/03/27 02:23:54 http: response.WriteHeader on hijacked connection from github.com/unrolled/logger.(*customResponseWriter).WriteHeader (logger.go:108)
```
Can we fix this somehow so that your library plays nicely with middleware that wraps it potentially?
贡献指南
这个仓库没有索引到贡献指南
调研方向
首先使用 msgbus 升级提交及其 Logging 和 GZIP middleware 设置,复现 logger.go:108 中来自 github.com/unrolled/logger.(*customResponseWriter).WriteHeader 的 response.WriteHeader 警告。跟踪 hijack 与 WriteHeader 的交互;当该库能够与包装 middleware 一起工作且不再出现警告时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- go
- 领域
- networking
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100