vmod_curl(3)
π NAME π
vmod_curl β cURL bindings for Varnish. that's the name, bestie, and it's from the Library Functions Manual, section 3. π
β¨
β¨ SYNOPSIS β¨
import curl [as name] [from "path"]
VOID get(STRING)
VOID head(STRING)
VOID fetch(STRING)
VOID post(STRING, STRING)
STRING header(STRING)
VOID free()
INT status()
STRING error()
STRING body()
VOID set_timeout(INT)
VOID set_connect_timeout(INT)
VOID set_ssl_verify_peer(INT)
VOID set_ssl_verify_host(INT)
VOID set_ssl_cafile(STRING)
VOID set_ssl_capath(STRING)
STRING escape(STRING)
STRING unescape(STRING)
VOID header_add(STRING)
VOID header_remove(STRING)
VOID header_add_all()
VOID proxy(STRING)
VOID set_proxy(STRING)
VOID set_method(STRING)
VOID set_unix_path(STRING)
VOID set_debug(ENUM)
okay so now the deets. no gatekeeping, just vibes and facts. π«Ά
VOID get(STRING)β GET the URL in the first parameter. πVOID head(STRING)β HEAD the URL in the first parameter. πVOID fetch(STRING)β compatibility name forget. iykyk. β¨VOID post(STRING, STRING)β POST the URL in the first parameter, with the body fields given in the second. π₯STRING header(STRING)β returns the header named in the first argument. πVOID free()β frees the memory used by headers. not needed tho β it will be handled automatically if it's not called. πINT status()β the HTTP status code. πSTRING error()β also right here in the lineup. π«ΆSTRING body()β okay so listen: a response body can contain chars that are not allowed into headers, e.g. CRLF. if the response body is a binary and/or it contains any special chars, then this function MUST be used viasynthetic:synthetic(curl.body()). otherwise it can be assigned to a header:resp.http.x-body = curl.body();. Test 12 for a complete example. π¨VOID set_timeout(INT)andVOID set_connect_timeout(INT)β bestie, these two are not global, they are per request functions, therefore they can't be used invcl_init. periodt. π«
the SSL crew and the string crew, all taking their params:
VOID set_ssl_verify_peer(INT)VOID set_ssl_verify_host(INT)VOID set_ssl_cafile(STRING)VOID set_ssl_capath(STRING)STRING escape(STRING)STRING unescape(STRING)
add / remove request headers, coming through:
VOID header_add(STRING)β add a request header. πVOID header_remove(STRING)β remove a request header. π
and for the whole set:
VOID header_add_all()β add all request headers from thereq(orbereq) object. π¦
then the rest of the squad:
VOID proxy(STRING)β proxy, with aSTRING. πVOID set_proxy(STRING)β set the proxy, with aSTRING. πVOID set_method(STRING)β set the method, with aSTRING. πVOID set_unix_path(STRING)β set the unix path, with aSTRING. πVOID set_debug(ENUM)β set debug, with anENUM. the enum values are exactly:
VOID set_debug(
ENUM {none, text, header_in, header_out, data_in, data_out}
)
that's the whole page, bestie. vmod_curl(3), out. πβ¨
π¦ where this page comes from
- ubuntu stonking: libvmod-curl 0.0~git20250603-4 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms