def try.stream

bend-kit-hairpin@0.13.0.1 · hairpin.bend:328

import bend-kit-hairpin@0.13.0.1/hairpin.bend as Hairpin
import Base
import bend-kit-http@0.38.1.1/http.bend as Http
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

328# One attempt that opens a stream on the pool: the redirect loop with the mode, the jar, and the certificate,
329# then the body decoded by enc.
330def try.stream(o: Opts, call: Call, pool: Http.Pool, jar: Maybe<&2, Http.Jar>, body: Bytes.Bytes) ->
331    IO(Http.Pool & Maybe<&2, Http.Jar> & Result<&1, &1, Http.Err, Http.Stream>):
332  Opts{base, h, +ms, mode, p, cert, ca} = o
333  Call{+enc, method, u, headers} = call
334  do IO<Http.Pool & Maybe<&2, Http.Jar> & Result<&1, &1, Http.Err, Http.Stream>>:
335    now : Maybe<&2, Http.Jar> <- jar.now(jar)
336    r : Http.Pool & Maybe<&2, Http.Jar> & Result<&1, &1, Http.Err, Http.Stream> <-
337      Http.stream.hops(mode, ms, (pool, Http.StreamHops{Http.stream.start(method, Http.accept.enc(headers, enc), body, u), cert, now, ca}))
338    Http.stream.init.pool(enc, r)

Uses (19)

Used by (1)