def up.conn

bend-kit-http@0.38.2.0 · http.bend:5401

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

5401def up.conn(r: Result<&1, &1, Err, Conn>, +ms: U32, +head: Bool, wire: String) -> IO(Result<&1, &1, Err, Up>):
5402  match r:
5403    case Fail{e}:
5404      IO.pure(Result<&1, &1, Err, Up>, Fail{e})
5405    case Done{c}:
5406      match c:
5407        case Conn{+tls, s}:
5408          do IO<Result<&1, &1, Err, Up>>:
5409            sent : Socket & Result<&1, &1, U32 & String, Unit> <- io.send.bytes(tls, s, Bytes.from_string(wire))
5410            return Done{up.sent(tls, ms, head, sent)}
5411        case ConnH2{s, client}:
5412          do IO<Result<&1, &1, Err, Up>>:
5413            Wire.tls.close(s)
5414            return Fail{ErrBad{}}

Uses (17)

Used by (1)