21 lines
690 B
Awk
Executable File
21 lines
690 B
Awk
Executable File
#!/usr/bin/awk -f
|
|
|
|
function handle_request(url, ip_fqdn, ident, method, kv)
|
|
{
|
|
if (url == "http://proxy/ca.crt") {
|
|
return "OK rewrite-url=http://127.0.0.1:9999/ca.crt"
|
|
}
|
|
return "OK"
|
|
}
|
|
|
|
\$1 ~ /^[0-9]+$/ {request_id=\$1 " "; request_url=\$2; request_ip_fqdn=\$3, request_ident=\$4, request_method=\$5, first_pair=6}
|
|
\$1 !~ /^[0-9]+$/ {request_id=""; request_url=\$1; request_ip_fqdn=\$2, request_ident=\$3, request_method=\$4, first_pair=5}
|
|
{
|
|
split("", kv);
|
|
for (i=first_pair; i<=NF; i++) {
|
|
split(\$i, parts, sep="=")
|
|
kv[parts[1]]=parts[2]
|
|
}
|
|
print request_id handle_request(request_url, request_ip_fqdn, request_ident, request_method, kv)
|
|
}
|