wasm: Close with codes other than 1000 throws, so CloseNow never closes
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 20/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- go
- Lĩnh vực
- networking
Hướng nghiên cứu
The issue describes the failure in the js/wasm build when Conn.Close passes unsupported codes to the browser's WebSocket.close, and links PR #576, which is already open. Read that pull request and the Close/CloseNow path it changes; the issue's expected behavior is that rejected codes are sent as 1000 so the browser closes the socket without an error or panic.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In the js/wasm build, Conn.Close passes the code straight to the browser's WebSocket.close, which only accepts 1000 and 3000-4999 and throws InvalidAccessError for anything else. This package closes with 1001 (CloseNow), 1008 (read or dial context done), 1009 (read limit) and 1011 (write error), so all of those return an error and leave the socket open. Under TinyGo the throw is not recovered, so the program panics.
To reproduce, dial any server and call c.CloseNow(). In Chromium it returns:
failed to close WebSocket: JavaScript error: Failed to execute 'close' on 'WebSocket': The close code must be either 1000, or between 3000 and 4999. 1001 is neither.
A fix is to send 1000 to the browser for the codes it rejects. I have a PR for it.
- Ngôn ngữ chính
- Go
- Star
- 5.5k
- Fork
- 379
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của coder/websocket
-
Must not wrap io.EOFCó thể đã có người làm @Yanhu007 đã nhận 175 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
export wstestĐang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
Tất cả issue của coder/websocket
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
golang/go#82033 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 90/100
FootprintAI/Containarium#2338 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: core doesn't build standalone on dev since a17068054 (go-mp3 require dropped, go.sum pruned)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
SagerNet/sing-openvpn#11 ·
-
priority: P3 type: devops
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jiegui2025/hwspec#57 ·
Maintainer thường phản hồi trong vòng 1 ngày