Update module code for Varnish 4
Jump through some hoops to reduce compiler warnings.