Project

General

Profile

Actions

Feature #2220

closed

Varnish 3 does not have the ability to change vcl_deliver function

Added by Magnus Forsberg about 12 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
02/20/2012
Due date:
% Done:

0%

Estimated time:
Plus Target Version:

Description

Running pfSense 2.0.1-RELEASE.
Installed and tested Varnish3

Varnish does have the ability to make custom changes to vcl_deliver function.

Patch to fix varnish_custom_vcl.xml:

diff -rub varnish_custom_vcl.xml.org varnish_custom_vcl.xml

--- varnish_custom_vcl.xml.org  2012-02-20 20:48:07.000000000 +0100
+++ varnish_custom_vcl.xml      2012-02-20 22:36:46.000000000 +0100
@@ -131,6 +131,24 @@
                        <rows>10</rows>
                        <encoding>base64</encoding>
                </field>
+               <field>
+                       <fielddescr>vcl_deliver_early</fielddescr>
+                       <fieldname>vcl_deliver_early</fieldname>
+                       <description>Paste your custom <![CDATA[<a target=_new href='http://varnish-cache.org/wiki/VCL'>vcl_deliver</a>]]> code here.  This code will be included at the beginning of the vcl_deliver function.</description>
+                       <type>textarea</type>
+                       <cols>50</cols>
+                       <rows>10</rows>
+                       <encoding>base64</encoding>
+               </field>
+               <field>
+                       <fielddescr>vcl_deliver_late</fielddescr>
+                       <fieldname>vcl_deliver_late</fieldname>
+                       <description>Paste your custom <![CDATA[<a target=_new href='http://varnish-cache.org/wiki/VCL'>vcl_deliver</a>]]> code here.  This code will be included at the end of the vcl_deliver function.</description>
+                       <type>textarea</type>
+                       <cols>50</cols>
+                       <rows>10</rows>
+                       <encoding>base64</encoding>
+               </field>
        </fields>
        <custom_php_validation_command>
        </custom_php_validation_command>

Patch to fix varnish.inc:

diff -rub varnish.inc.org varnish.inc
--- varnish.inc.org     2012-02-20 20:21:40.000000000 +0100
+++ varnish.inc 2012-02-20 22:35:57.000000000 +0100
@@ -392,6 +392,10 @@
                                $vcl_pipe_early = text_area_decode($vcl['vcl_pipe_early']);
                        if($vcl['vcl_pipe_late'])
                                $vcl_pipe_late = text_area_decode($vcl['vcl_pipe_late']);
+                       if($vcl['vcl_deliver_early'])
+                               $vcl_deliver_early = text_area_decode($vcl['vcl_deliver_early']);
+                       if($vcl['vcl_deliver_late'])
+                               $vcl_deliver_late = text_area_decode($vcl['vcl_deliver_late']);
                }
        }
                $vcl_recv_set_basic='#BASIC VCL RULES SETTING'."\n";
@@ -616,6 +620,7 @@
 }

 sub vcl_deliver {
+       {$vcl_deliver_early}
        ##set resp.http.X-Served-By = server.hostname;
        if (obj.hits > 0) {
        set resp.http.X-Cache = "HIT";
@@ -623,6 +628,7 @@
        } else {
        set resp.http.X-Cache = "MISS";
        }
+       {$vcl_deliver_late}
        return(deliver);
 }

Actions #1

Updated by Torben Hørup about 11 years ago

Nice one, but you will get more success on getting it into main branch if you create a pull request with the changes.

Actions #2

Updated by Chris Buechler almost 8 years ago

  • Status changed from New to Closed

this package has been deprecated

Actions

Also available in: Atom PDF