def stream.one.of

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

import bend-kit-http@0.38.2.0/http.bend as Http
import Base
import bend-kit-url@0.4.1.0/url.bend as Url
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

5068# sent is headers plus any jar cookies; the hop keeps headers, so cookies never pile up across hops.
5069def stream.one.of(p: Pool, +method: String, +url: Url.Abs, headers: Map<&2, List<&2, String>>, sent: Map<&2, List<&2, String>>,
5070    +ms: U32, r: Bytes.Bytes & Bytes.Bytes, cert: Maybe<&2, Cert>, +ca: String) -> IO(Pool & Hop & Result<&1, &1, Err, Stream>):
5071  Url.Abs{+scheme, +host, +port, target} = url
5072  (body, wire) = r
5073  do IO<Pool & Hop & Result<&1, &1, Err, Stream>>:
5074    choice : Maybe<&2, Proxy> <- proxy.select(scheme, host, port)
5075    got : Pool & Result<&1, &1, Err, Stream> <-
5076      stream.origin(p, method, ms, sent, wire, Url.host_field(url), url,
5077        pool.scheme.ok(url), cert, ca, choice)
5078    return stream.one.back(Hop{method, url, headers, body}, got)

Uses (24)

Used by (1)