Backends

WARNING!!!

lhc used to and will again support the concept of pluings, allowing users to wrap their preferred HTTP client library.

Currently backend support has been suspended and the httpc client that comes bundled with Erlang is hard-coded.

Old backends:

Planned backends currently include the following:

Selecting

Edit the backend value in the lhc section of your lfe.config file. See the lhc lfe.config for an example of this. Once edited, running start will use that value:

> (lhc:start)
(#(inets ok) #(ssl ok) #(lhttpc ok) #(lhc ok))
> (lhc:get-backend)
lhttpc
>

You can also start lhc with your preferred backend:

> (lhc:start 'httpc)
(#(inets ok) #(ssl ok) #(lhc ok))
>

You can change backends at any time:

> (lhc:change-backend 'lhttpc)
(#(backend #(previous httpc) #(current lhttpc)))
>

Bakends my be selected one of three ways:

  • setting the backend value in the lhc section of the lfe.config file
  • Starting lhc with a particular bacend.
  • Changing the backend after lhc has been started.

Backend Information

Find out which backend you are using:

> (lhc:get-backend)
lhttpc
>

Find out which backend is configured in your lfe.config file:

> (lhc:get-backend-cfg)
lhttpc

Find out which module holds the backend functions:

> (lhc:get-backend-module)
lhc-backend

Several convenience functions are provided in support of lhc backends.

See examples to the right.