Add support for IRCv3 WebSocket text subprotocol

Technically we aren't spec-compliant since we don't serve
binary.ircv3.net. Any complaints will be redirected to /dev/null.
This commit is contained in:
Simon Ser 2021-09-28 21:25:06 +02:00
parent fce86b0f0d
commit 5bedcd24e2

View File

@ -206,6 +206,7 @@ func (s *Server) Serve(ln net.Listener) error {
func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) { func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
conn, err := websocket.Accept(w, req, &websocket.AcceptOptions{ conn, err := websocket.Accept(w, req, &websocket.AcceptOptions{
Subprotocols: []string{"text.ircv3.net"}, // non-compliant, fight me
OriginPatterns: s.HTTPOrigins, OriginPatterns: s.HTTPOrigins,
}) })
if err != nil { if err != nil {