Giter VIP home page Giter VIP logo

libvmod-curl's Introduction

Travis CI badge

This vmod provides cURL bindings for Varnish so you can use Varnish as an HTTP client and fetch headers and bodies from backends.

WARNING: Using vmod-curl to connect to HTTPS sites is currently unsupported and may lead to segmentation faults on VCL load/unload. (openssl library intricacies)

Installation

Source releases can be downloaded from:

https://download.varnish-software.com/libvmod-curl/

Installation requires an installed version of Varnish Cache, including the development files. Requirements can be found in the Varnish documentation.

Source code is built with autotools, you need to install the correct development packages first. If you are using the official Varnish Project packages:

sudo apt install varnish-dev || sudo yum install varnish-devel

If you are using the distro provided packages:

sudo apt install libvarnishapi-dev || sudo yum install varnish-libs-devel

In both cases, you also need the libcurl development package:

sudo apt install libcurl4-openssl-dev || sudo yum install libcurl-devel

Then proceed to the configure and build:

./configure
make
make check   # optional
sudo make install

The resulting loadable modules (libvmod_*.so files) will be installed to the Varnish module directory. (default /usr/lib/varnish/vmods/)

Usage

To use the vmod do something along the lines of:

import curl;

sub vcl_recv {
        curl.get("http://example.com/test");
        if (curl.header("X-Foo") == "bar") {
        ...
        }

        curl.free();
}

See src/vmod_curl.vcc for the rest of the callable functions.

Development

The source git tree lives on Github: https://github.com/varnish/libvmod-curl

All source code is placed in the master git branch. Pull requests and issue reporting are appreciated.

Unlike building from releases, you need to first bootstrap the build system when you work from git. In addition to the dependencies mentioned in the installation section, you also need to install the build tools:

sudo apt-get automake autotools-dev python-docutils

Then build the vmod:

./autogen.sh
./configure
make
make check # recommended

If the configure step succeeds but the make step fails, check for warnings in the ./configure output or the config.log file. You may be missing bootstrap dependencies not required by release archives.

If you have installed Varnish to a non-standard directory, call autogen.sh and configure with PKG_CONFIG_PATH and ACLOCAL_PATH pointing to the appropriate path. For instance, when varnishd configure was called with --prefix=$PREFIX, use:

export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export ACLOCAL_PATH=$PREFIX/share/aclocal

--

Development of this VMOD has been sponsored by the Norwegian company Aspiro Music AS for usage on their WiMP music streaming service.

libvmod-curl's People

Contributors

fgsch avatar mbgrydeland avatar aondio avatar daghf avatar dridi avatar dmatetelki avatar carlosabalde avatar chino avatar dbu avatar comotion avatar kristianlyng avatar lkarsten avatar chenrui333 avatar zmousm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.