def pool.one.of

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

import bend-kit-http@0.38.4.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

3873# sent is headers plus any jar cookies; the hop keeps headers, so cookies never pile up across hops.
3874def pool.one.of(p: Pool, +method: String, +url: Url.Abs,
3875    headers: Map<&2, List<&2, String>>, sent: Map<&2, List<&2, String>>,
3876    +ms: U32, r: Bytes.Bytes & Bytes.Bytes, cert: Maybe<&2, Cert>, +ca: String) ->
3877    IO(Pool & Result<&1, &1, Err, Res> & Hop):
3878  Url.Abs{+scheme, +host, +port, target} = url
3879  (body, wire) = r
3880  do IO<Pool & Result<&1, &1, Err, Res> & Hop>:
3881    choice : Maybe<&2, Proxy> <- proxy.select(scheme, host, port)
3882    pr : Pool & Result<&1, &1, Err, Res> <-
3883      pool.origin(p, method, ms, sent, wire, Url.host_field(url),
3884        url, pool.scheme.ok(url), cert, ca, choice)
3885    return pool.one.back(Hop{method, url, headers, body}, pr)

Uses (24)

Used by (1)