From 1faa962287717416b27da9dfd6b3be4fdfcc909a Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 2 Jul 2007 13:08:07 +0000 Subject: [PATCH] Add vcl_deliver() method where touch-up's to the returned reply can be performed. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1612 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/mgt_vcc.c | 3 +++ varnish-cache/include/vcl.h | 1 + varnish-cache/include/vcl_returns.h | 8 +++++--- varnish-cache/lib/libvcl/vcc_fixed_token.c | 17 +---------------- .../lib/libvcl/vcc_gen_fixed_token.tcl | 1 + 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/varnish-cache/bin/varnishd/mgt_vcc.c b/varnish-cache/bin/varnishd/mgt_vcc.c index 15d12059..e91d70f2 100644 --- a/varnish-cache/bin/varnishd/mgt_vcc.c +++ b/varnish-cache/bin/varnishd/mgt_vcc.c @@ -127,6 +127,9 @@ static const char *default_vcl = " }\n" " insert;\n" "}\n" + "sub vcl_deliver {\n" + " deliver;\n" + "}\n" "sub vcl_discard {\n" " discard;\n" "}\n" diff --git a/varnish-cache/include/vcl.h b/varnish-cache/include/vcl.h index af7f75d0..881e6e96 100644 --- a/varnish-cache/include/vcl.h +++ b/varnish-cache/include/vcl.h @@ -38,6 +38,7 @@ struct VCL_conf { vcl_func_f *miss_func; vcl_func_f *hit_func; vcl_func_f *fetch_func; + vcl_func_f *deliver_func; vcl_func_f *timeout_func; vcl_func_f *discard_func; }; diff --git a/varnish-cache/include/vcl_returns.h b/varnish-cache/include/vcl_returns.h index 848ec6ac..4f3f53a9 100644 --- a/varnish-cache/include/vcl_returns.h +++ b/varnish-cache/include/vcl_returns.h @@ -41,6 +41,7 @@ VCL_MET_MAC(hash,HASH,(VCL_RET_HASH)) VCL_MET_MAC(miss,MISS,(VCL_RET_ERROR|VCL_RET_PASS|VCL_RET_FETCH)) VCL_MET_MAC(hit,HIT,(VCL_RET_ERROR|VCL_RET_PASS|VCL_RET_DELIVER)) VCL_MET_MAC(fetch,FETCH,(VCL_RET_ERROR|VCL_RET_PASS|VCL_RET_INSERT)) +VCL_MET_MAC(deliver,DELIVER,(VCL_RET_ERROR|VCL_RET_DELIVER)) VCL_MET_MAC(timeout,TIMEOUT,(VCL_RET_FETCH|VCL_RET_DISCARD)) VCL_MET_MAC(discard,DISCARD,(VCL_RET_DISCARD|VCL_RET_KEEP)) #else @@ -51,7 +52,8 @@ VCL_MET_MAC(discard,DISCARD,(VCL_RET_DISCARD|VCL_RET_KEEP)) #define VCL_MET_MISS (1 << 4) #define VCL_MET_HIT (1 << 5) #define VCL_MET_FETCH (1 << 6) -#define VCL_MET_TIMEOUT (1 << 7) -#define VCL_MET_DISCARD (1 << 8) +#define VCL_MET_DELIVER (1 << 7) +#define VCL_MET_TIMEOUT (1 << 8) +#define VCL_MET_DISCARD (1 << 9) #endif -#define N_METHODS 9 +#define N_METHODS 10 diff --git a/varnish-cache/lib/libvcl/vcc_fixed_token.c b/varnish-cache/lib/libvcl/vcc_fixed_token.c index b144b982..edad77f1 100644 --- a/varnish-cache/lib/libvcl/vcc_fixed_token.c +++ b/varnish-cache/lib/libvcl/vcc_fixed_token.c @@ -350,6 +350,7 @@ vcl_output_lang_h(struct vsb *sb) vsb_cat(sb, " vcl_func_f *miss_func;\n"); vsb_cat(sb, " vcl_func_f *hit_func;\n"); vsb_cat(sb, " vcl_func_f *fetch_func;\n"); + vsb_cat(sb, " vcl_func_f *deliver_func;\n"); vsb_cat(sb, " vcl_func_f *timeout_func;\n"); vsb_cat(sb, " vcl_func_f *discard_func;\n"); vsb_cat(sb, "};\n"); @@ -453,29 +454,17 @@ vcl_output_lang_h(struct vsb *sb) vsb_cat(sb, " * Edit vcc_gen_obj.tcl instead\n"); vsb_cat(sb, " */\n"); vsb_cat(sb, "\n"); - vsb_cat(sb, "const char * VRT_r_backend_host(struct backend *);\n"); vsb_cat(sb, "void VRT_l_backend_host(struct backend *, const char *);\n"); - vsb_cat(sb, "const char * VRT_r_backend_port(struct backend *);\n"); vsb_cat(sb, "void VRT_l_backend_port(struct backend *, const char *);\n"); - vsb_cat(sb, "double VRT_r_backend_dnsttl(struct backend *);\n"); vsb_cat(sb, "void VRT_l_backend_dnsttl(struct backend *, double);\n"); vsb_cat(sb, "struct sockaddr * VRT_r_client_ip(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_client_ip(struct sess *, struct sockaddr *);\n"); vsb_cat(sb, "struct sockaddr * VRT_r_server_ip(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_server_ip(struct sess *, struct sockaddr *);\n"); vsb_cat(sb, "const char * VRT_r_req_request(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_request(struct sess *, const char *);\n"); - vsb_cat(sb, "const char * VRT_r_req_host(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_host(struct sess *, const char *);\n"); vsb_cat(sb, "const char * VRT_r_req_url(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_url(struct sess *, const char *);\n"); vsb_cat(sb, "const char * VRT_r_req_proto(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_proto(struct sess *, const char *);\n"); vsb_cat(sb, "struct backend * VRT_r_req_backend(struct sess *);\n"); vsb_cat(sb, "void VRT_l_req_backend(struct sess *, struct backend *);\n"); vsb_cat(sb, "const char * VRT_r_req_http_(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_http_(struct sess *, const char *);\n"); - vsb_cat(sb, "const char * VRT_r_req_hash(struct sess *);\n"); vsb_cat(sb, "void VRT_l_req_hash(struct sess *, const char *);\n"); vsb_cat(sb, "unsigned VRT_r_obj_valid(struct sess *);\n"); vsb_cat(sb, "void VRT_l_obj_valid(struct sess *, unsigned);\n"); @@ -484,11 +473,7 @@ vcl_output_lang_h(struct vsb *sb) vsb_cat(sb, "double VRT_r_obj_ttl(struct sess *);\n"); vsb_cat(sb, "void VRT_l_obj_ttl(struct sess *, double);\n"); vsb_cat(sb, "const char * VRT_r_resp_proto(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_resp_proto(struct sess *, const char *);\n"); vsb_cat(sb, "int VRT_r_resp_status(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_resp_status(struct sess *, int);\n"); vsb_cat(sb, "const char * VRT_r_resp_response(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_resp_response(struct sess *, const char *);\n"); vsb_cat(sb, "const char * VRT_r_resp_http_(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_resp_http_(struct sess *, const char *);\n"); } diff --git a/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl b/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl index 7657dd1a..d2af8ea8 100755 --- a/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl +++ b/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl @@ -41,6 +41,7 @@ set methods { {miss {error pass fetch}} {hit {error pass deliver}} {fetch {error pass insert}} + {deliver {error deliver}} {timeout {fetch discard}} {discard {discard keep}} } -- 2.39.5