Skip to content

Instantly share code, notes, and snippets.

@rezan
rezan / no_args.c
Created Oct 18, 2021
Valid C program, no errors (-Wall -Wextra -Wpedantic -Werror)
View no_args.c
#include <stdio.h>
void test();
int main()
{
printf("no args\n");
test();
return 0;
}
@rezan
rezan / states.vcl
Created Mar 30, 2021
VHA6 req.url rewrite hook
View states.vcl
#
# VHA6 req.url rewrite hook
#
# File location: /etc/varnish/vha6/hooks/states.vcl
#
import std;
sub vha6_hook_init {
}
@rezan
rezan / miss_302.vcl
Created Feb 19, 2021
Varnish VCL - cache misses get an instant 302 response and are fetched in the background
View miss_302.vcl
#
# Cache misses get an instant 302 response and are fetched in the background
# (Include this file in your VCL)
#
vcl 4.1;
import std;
import synthbackend;
import vha;
@rezan
rezan / probe_proxy.vcl
Last active Dec 1, 2020
Probe Proxy implementation
View probe_proxy.vcl
#
# Probe Proxy v1.0
#
import directors;
import kvstore;
import probe_proxy;
import std;
acl probe_proxy_local {
@rezan
rezan / body_restart.vtc
Created Sep 21, 2020
req.body and restarts
View body_restart.vtc
varnishtest "req.body and restarts"
server s1 -repeat 4 {
rxreq
txresp -bodylen 1000
} -start
varnish v1 -vcl+backend {
import std;
@rezan
rezan / S00001.vtc
Created Jul 6, 2020
varnishscoreboard vcl_recv
View S00001.vtc
varnishtest "varnishscoreboard vcl_recv"
barrier b1 sock 2
barrier b2 sock 2
server s1 {
} -start
varnish v1 -cliok "param.set thread_pool_track on" -vcl+backend {
@rezan
rezan / S00002.vtc
Created Jul 6, 2020
varnishscoreboard parallel ESI
View S00002.vtc
varnishtest "varnishscoreboard parallel ESI"
barrier b1 cond 3
barrier b2 cond 3
server s1 {
rxreq
txresp -body {
<esi:include src="/c1"/>
<esi:include src="/c2"/>
@rezan
rezan / client_error.vtc
Created Jun 18, 2020
Varnish client download error
View client_error.vtc
varnishtest "varnishncsa logging a client error"
server s1 {
rxreq
txresp -bodylen 10000000
} -start
varnish v1 -vcl+backend {
} -start
@rezan
rezan / goto_fallback.vtc
Created May 7, 2020
Varnish - goto and fallback
View goto_fallback.vtc
varnishtest "Goto and fallbacks"
server s1 {
rxreq
txresp
expect req.url == "/probe"
accept
rxreq
txresp
@rezan
rezan / aws_secrets_manager.vcl
Created Apr 15, 2020
AWS Secrets Manager Varnish VCL Implementation
View aws_secrets_manager.vcl
#
# AWS Secrets Manager v1.0
#
import crypto;
import http;
import json;
import kvstore;
import utils;