def conn.tls.protocol

bend-kit-http@0.38.4.0 · http.bend:2797

import bend-kit-http@0.38.4.0/http.bend as Http
import Base
import bend-kit-wire@0.4.8.0/wire.bend as Wire
import bend-kit-http2@0.4.0.0/http2.bend as H2

2797def conn.tls.protocol(proto: String, s: Socket) -> IO(Result<&1, &1, Err, Conn>):
2798  match proto:
2799    case "h2":
2800      conn.h2.start(s, H2.client.start())
2801    case "http/1.1":
2802      IO.pure(Result<&1, &1, Err, Conn>, Done{Conn{True{}, s}})
2803    case "":
2804      IO.pure(Result<&1, &1, Err, Conn>, Done{Conn{True{}, s}})
2805    case other:
2806      do IO<Result<&1, &1, Err, Conn>>:
2807        Wire.tls.close(s)
2808        return Fail{ErrTls{71, "unsupported ALPN: " ++ other}}

Uses (18)

Used by (1)