- In probe support, renamed
Request::URL
toRequest::Url
- Bump MSRV to 1.82.0
- Support for Varnish v6.0 LTS, but without filters, and without
vmod_be
,vmod_vfp
,vmod_vdp
examples - Require all user functions that return
VCL_*
types to beunsafe
- User functions can return
&CStr
as a return value or a&'static CStr
error - Support for safe fetch and delivery filter registration and automatic cleanup. See
vmod_vfp
andvmod_vdp
examples. - Rename
VSC
→Stats
,VSCBuilder
→StatsBuilder
, andVSCInternal
intoStatsImpl
- Consolidate
Probe
andCowProbe<'a>
into oneProbe<T>
struct with a genericString
orCow<str>
. - Rename
new
tofrom_ptr
forBuffer
,Workspace
,HttpHeaders
,FetchProcCtx
,DeliveryProcCtx
, and make them private. OnlyCtx::from_ptr
is public because it gets created by a macro-generated function. - Make
txt::from_bytes
private - use other constructors instead - Added
VclError::WsOutOfMemory
variant whenWorkspace::alloc
fails - Many changes to
Workspace
API:- All
Workspace
functions now returnVclError
rather than error strings alloc
was marked asunsafe
alloc
now returns a*mut c_void
instead of aVclResult<&'a mut [u8]>
alloc
now panics if requested size is 0- Renamed
is_slice_allocated
tocontains
- Added allocation and copying functions:
allocate(...) -> &mut [MaybeUninit<u8>]
(un-initialized memory)allocate_zeroed(...) -> &mut [u8]
(initialized memory)copy_blob(...) -> VCL_BLOB
copy_txt(...) -> txt
- Removed
copy_bytes
- usecopy_*
andalloc_*
functions instead - Removed
copy_str
- usecopy_cstr
instead
- All
- Introduce a new, vastly improved system of generating boilerplate code using a procedural macro
#[varnish(vmod)]
by @nyurik- The macro will generate all the boilerplate code for a Varnish VMOD
- The macro attribute must be used on a
mod
block that contains the VMOD functions - The macro can generate a markdown file, e.g.
#[varnish(docs = "README.md")]
- All examples have been updated to use the new system
- See crate documentation for more details
vtc!
macro has been replaced withrun_vtc_tests!("tests/*.vtc")
:- supports glob patterns
- supports
VARNISHTEST_DURATION
env var, defaulting to "5s" - supports debug mode - keeps the temporary files and always prints the output:
run_vtc_tests!!("tests/*.vtc", true)
- Multi-version support for
libvarnish
headers now allows the same code to be used with Varnish v7.4, v7.5, and v7.6 - Set MSRV to 1.77.0 - the minimum version of Rust required to use this crate
- Most FFI objects are public only if the user enables the
ffi
feature. This is to prevent users from using the FFI directly and to encourage them to use the safe Rust API. SemVer guarantees that the public API will not change, but the FFI API may change without warning. - Introduce
vsc
feature to enable thevarnish::vsc
module - Renamed a few types for clarity and to be more consistent:
COWProbe
struct toCowProbe
COWRequest
struct toCowRequest
HTTP
struct toHttpHeaders
HTTPIter
struct toHttpHeadersIter
VDPCtx
struct toDeliveryProcCtx
VDP
trait toDeliveryProcessor
VFPCtx
struct toFetchProcCtx
VFP
trait toFetchProcessor
Vsb
struct toBuffer
Vsb::cat
function toBuffer::write
WS
struct toWorkspace
- Renamed auto-generated C enums to be more consistent and easier to use in Rust:
enum VSL_tag_e
→VslTag
, removingSLT_
prefix on enum values, e.g.SLT_Debug
->Debug
enum boc_state_e
→BocState
, removingBOS_
prefix on enum values, e.g.BOS_INVALID
->Invalid
enum director_state_e
→DirectorState
, removingDIR_S_
prefix on enum values, e.g.DIR_S_NULL
->Null
enum gethdr_e
→GetHeader
, removingHDR_
prefix on enum values, e.g.HDR_REQ_TOP
->ReqTop
enum lbody_e
→Body
, removingLBODY_
prefix on enum values, e.g.LBODY_SET_STRING
->SetString
enum sess_attr
→SessionAttr
, removingSA_
prefix on enum values, e.g.SA_TRANSPORT
->Transport
enum task_prio
→TaskPriority
, removingTASK_QUEUE_
prefix on enum values, e.g.BO
->TaskQueueBo
enum vas_e
→Vas
, removingVAS_
prefix on enum values, e.g.VAS_WRONG
->Wrong
enum vcl_event_e
→VclEvent
, removingVCL_EVENT_
prefix on enum values, e.g.VCL_EVENT_LOAD
->Load
enum vcl_func_call_e
→VclFuncCall
, removingVSUB_
prefix on enum values, e.g.VSUB_STATIC
->Static
enum vcl_func_fail_e
→VclFuncFail
, removingVSUB_E_
prefix on enum values, e.g.VSUB_E_OK
->Ok
enum vdp_action
→VdpAction
, removingVDP_
prefix on enum values, e.g.VDP_NULL
->Null
enum vfp_status
→VfpStatus
, removingVFP_
prefix on enum values, e.g.VFP_ERROR
->Error
vsc::Error
implementsstd::Error
- improve
vtc!()
debuggability - use newer
bindgen
- adjust to Varnish 7.5.0
- adjust to Varnish 7.4.0
- fix
vsc
assert
- Varnish 7.3 support
- Fix crash in
Backend
code due do wrong pointer cast - Add
varnish::vsc
- More docs
VFP::new()
andVDP::new()
now take amut
ref to the context
Backend::new()
get an extra argument:has_probe
Probe
is renamedCOWProbe
, andProbe
now owns itsString
s
cache_director.h
added tovarnish-sys
generate_boilerplate!
now reads thePYTHON
environment variable before falling back topython3
to generate codevarnish-rs
reexports the VCL types needed to generate boilerplate code, so that vmods don't need to addvarnish-sys
to theirCargo.toml
anymore.- introduce
vcl::Backend
and co. VCL_IP can be translated to
Optionstd::net::SockAdd` and back- fix compilation issues on arm
- introduce
vcl::Error
andvcl::Result
- ctx->handling is now hidden from us, so we use
VRT_fail
, at the cost of a string copy - the JSON format in vmod_data changed slightly, adjust for that
- explicitly
drop
Box::from_raw
results to silencerustc
- fix generated
__fini
prototype
- dumb vsb support (
vcl::vsb::Vsb
)) - probe support (
vcl::probe::Probe
) - vmod object constructors must now return results
Intoresult
require theErr()
to implementToString()
- adjust to Varnish 7.1.0
- switch to a cargo workspace to speed up builds
- fix buffer size issue in VFPs
- do not copy workspace STRINGS into the workspace again
- fix generated code involving default STRING arguments
- C types now derive
Copy
,Debug
andDefault
- silence
clippy
for generated code - expose
http_conn
- introduce
HTTP::set_status()
,HTTP::set_prototype()
andHTTP::set_reason()
- fix a boilerplate issue when using options (extra comma)
- fix handling of option
STRING
parameters - introduce delivery and fetch processors
- introduce
VPriv::take()
- introduce
WS::copy_bytes_with_null()
convert
accepts more types, includingOption<&std|String|&[u8]>
example/vmod_vdp
example/vmod_vfp
VARNISH_INCLUDE_PATHS
allows to build bindings in non-standard environmentsvtc!
macro will also printstderr
in case of failure- introduce
Ctx::req_body()
- introduce
WS::reserve()
andWS::release()
- introduce
Ctx::log
libvarnishapi
version invarnish-sys
metadata- more robust
IntoResult
implementation - All VCL types are recognized (but not necessarily completely "rustified")
- vmod event support
example/vmod_event
- documentation starts getting a bit serious
- CI with GitHub actions
- simplify the vmod structure,
src/vmod.rs
disappears example/vmod_timestamp
example/vmod_infiniteloop
- docs can be built even without
libvarnishapi
installed - fix vmod object support
example/vmod_object
- vmods can return a Result that will automatically call VRT_fail() if needed
example/vmod_error
example/vmod_example
Initial release