def up.conn

bend-kit-http@0.38.5.0 · http.bend:5393

import bend-kit-http@0.38.5.0/http.bend as Http
import Base
import bend-kit-wire@0.4.8.0/wire.bend as Wire
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

5393def up.conn(r: Result<&1, &1, Err, Conn>, +ms: U32, +head: Bool, wire: String) -> IO(Result<&1, &1, Err, Up>):
5394  match r:
5395    case Fail{e}:
5396      IO.pure(Result<&1, &1, Err, Up>, Fail{e})
5397    case Done{c}:
5398      match c:
5399        case Conn{+tls, s}:
5400          do IO<Result<&1, &1, Err, Up>>:
5401            sent : Socket & Result<&1, &1, U32 & String, Unit> <- io.send.bytes(tls, s, Bytes.from_string(wire))
5402            return Done{up.sent(tls, ms, head, sent)}
5403        case ConnH2{s, client}:
5404          do IO<Result<&1, &1, Err, Up>>:
5405            Wire.tls.close(s)
5406            return Fail{ErrBad{}}

Uses (17)

Used by (1)