coder / coder/websocket

Hijack before WriteHeader to avoid issues with middleware and Gin

Đang mở
#335 10 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Go
Star
5.5k
Fork
372
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start by reproducing the response.WriteHeader warning from github.com/unrolled/logger.(*customResponseWriter).WriteHeader at logger.go:108, using the msgbus upgrade commit and its Logging and GZIP middleware setup. Trace the hijack and WriteHeader interaction; done means the library works with wrapping middleware without the warning.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
go
Lĩnh vực
networking
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.