}
unsigned
-VRT_r_backend_healthy(const struct sess *sp)
+VRT_r_req_backend_healthy(const struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC);
--- /dev/null
+# $Id$
+
+test "Check req.backend.healthy"
+
+server s1 {
+ rxreq
+ expect req.url == "/"
+ txresp -body "slash"
+} -start -repeat 4
+
+varnish v1 -vcl {
+
+ backend default {
+ .host = "127.0.0.1";
+ .port = "9080";
+ .max_connections = 1;
+ .probe = {
+ .url = "/";
+ .timeout = 100 ms;
+ .interval = 1s;
+ .window = 3;
+ .threshold = 2;
+ }
+ }
+
+ sub vcl_recv {
+ if (req.backend.healthy) {
+ error 200 "Backend healthy";
+ } else {
+ error 500 "Backend sick";
+ }
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.status == 500
+} -run
+
+shell "sleep 1"
+
+client c2 {
+ txreq
+ rxresp
+ expect resp.status == 200
+} -start
+
const char * VRT_r_resp_response(const struct sess *);
void VRT_l_resp_response(const struct sess *, const char *, ...);
double VRT_r_now(const struct sess *);
-unsigned VRT_r_backend_healthy(const struct sess *);
+unsigned VRT_r_req_backend_healthy(const struct sess *);
vsb_cat(sb, "const char * VRT_r_resp_response(const struct sess *);\n");
vsb_cat(sb, "void VRT_l_resp_response(const struct sess *, const char *, ...);\n");
vsb_cat(sb, "double VRT_r_now(const struct sess *);\n");
- vsb_cat(sb, "unsigned VRT_r_backend_healthy(const struct sess *);\n");
+ vsb_cat(sb, "unsigned VRT_r_req_backend_healthy(const struct sess *);\n");
}
{recv pipe pass hash miss hit fetch deliver discard timeout}
"const struct sess *"
}
- { backend.healthy RO BOOL
+ { req.backend.healthy RO BOOL
{recv pipe pass hash miss hit fetch deliver discard timeout}
"const struct sess *"
}
0,
VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_DISCARD | VCL_MET_TIMEOUT
},
- { "backend.healthy", BOOL, 15,
- "VRT_r_backend_healthy(sp)",
+ { "req.backend.healthy", BOOL, 19,
+ "VRT_r_req_backend_healthy(sp)",
NULL,
V_RO,
0,