<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hank Beaver &#187; varnish</title>
	<atom:link href="http://www.hankbeaver.com/index.php/tag/varnish/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hankbeaver.com</link>
	<description>Ruby, open-source, Internet technologist located in Atlanta, GA, USA</description>
	<lastBuildDate>Tue, 29 Jun 2010 05:34:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Testing Varnish VCL Syntax</title>
		<link>http://www.hankbeaver.com/index.php/2009/11/02/testing-varnish-vcl-syntax/</link>
		<comments>http://www.hankbeaver.com/index.php/2009/11/02/testing-varnish-vcl-syntax/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 18:15:00 +0000</pubDate>
		<dc:creator>hbeaver</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[check]]></category>
		<category><![CDATA[syntax]]></category>
		<category><![CDATA[validate]]></category>
		<category><![CDATA[varnish]]></category>
		<category><![CDATA[vcl]]></category>

		<guid isPermaLink="false">http://www.hankbeaver.com/?p=120</guid>
		<description><![CDATA[The simplest way to test syntax is to use the administration console via telnet on a Dev/QA Varnish machine. Your current running Varnish should allow your IP/localhost to connect if you have implemented a Varnish ACL.

Start up Varnish with single command-line
Login to console via telnet
Load the config you wish to test
Use the config.

On OSX:

sudo /usr/local/sbin/varnishd [...]]]></description>
			<content:encoded><![CDATA[<p>The simplest way to test syntax is to use the administration console via telnet on a Dev/QA Varnish machine. Your current running Varnish should allow your IP/localhost to connect if you have implemented a Varnish ACL.</p>
<ul>
<li>Start up Varnish with single command-line</li>
<li>Login to console via telnet</li>
<li>Load the config you wish to test</li>
<li>Use the config.</li>
</ul>
<p>On OSX:</p>
<pre>
sudo /usr/local/sbin/varnishd -F  -a localhost:3000 -b localhost:6081 -T localhost:6082
</pre>
<p>From another console/shell/ open connection to Varnish management console:</p>
<pre>
telnet localhost 6082
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
</pre>
<p>Load config and try to use (the config used in this example has a syntax problem. Therefore, you will see compilation errors:</p>
<pre>
vcl.load error /Users/hbeaver/code/varnish_demo/config/syntax_error.vcl
106 181
Message from VCC-compiler:
Expected one of
	'acl', 'sub', 'backend',  or 'director'
Found: '}' at
(input Line 12 Pos 1)
}
#
Running VCC-compiler failed, exit 1VCL compilation failed
</pre>
<p>Conversely, if the VCL has good syntax you should see no errors:</p>
<pre>
vcl.load good_config /Users/hbeaver/code/varnish_demo/config/default.vcl
200 13
VCL compiled.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.hankbeaver.com/index.php/2009/11/02/testing-varnish-vcl-syntax/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Varnish cache purge Rake task</title>
		<link>http://www.hankbeaver.com/index.php/2009/07/15/varnish-cache-purge-rake-task/</link>
		<comments>http://www.hankbeaver.com/index.php/2009/07/15/varnish-cache-purge-rake-task/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 02:28:24 +0000</pubDate>
		<dc:creator>hbeaver</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[varnish]]></category>
		<category><![CDATA[purge]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[task]]></category>

		<guid isPermaLink="false">http://www.rubyslacker.com/?p=93</guid>
		<description><![CDATA[This example uses Ruby to telnet into Varnish and issue the &#8220;url.purge .*&#8221; command. The only gotcha is that the varnish telnet server does not issue a command prompt which causes Ruby telnet to timeout and get cranky. Well a little exception handling hacks past this. Enjoy.

require 'rubygems'

namespace "varnish" do

  desc "Purge ALL urls [...]]]></description>
			<content:encoded><![CDATA[<p>This example uses Ruby to telnet into Varnish and issue the &#8220;url.purge .*&#8221; command. The only gotcha is that the varnish telnet server does not issue a command prompt which causes Ruby telnet to timeout and get cranky. Well a little exception handling hacks past this. Enjoy.</p>
<pre>
require 'rubygems'

namespace "varnish" do

  desc "Purge ALL urls from Varnish"
  task :global_purge => :environment do

    #It WILL timeout, just accept it. Varnish does not have a command prompt.
    require 'net/telnet'
    @result = ""
    begin
      localhost = Net::Telnet::new("Host" => "localhost",
      "Port" => 6082,
      "Timeout" => 5)
      localhost.cmd("url.purge .*") { |c| @result = c}
    rescue Exception
      if @result.include? ("200 0")
        puts "varnish purged OK."
      else
        raise "Varnish not purged."
      end
    end
  end

end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.hankbeaver.com/index.php/2009/07/15/varnish-cache-purge-rake-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reminder to self and world: Varnish uses POSIX regex.</title>
		<link>http://www.hankbeaver.com/index.php/2009/07/14/reminder-to-self-and-world-varnish-uses-posix-regex/</link>
		<comments>http://www.hankbeaver.com/index.php/2009/07/14/reminder-to-self-and-world-varnish-uses-posix-regex/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 19:26:45 +0000</pubDate>
		<dc:creator>hbeaver</dc:creator>
				<category><![CDATA[regex]]></category>
		<category><![CDATA[varnish]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[posix]]></category>

		<guid isPermaLink="false">http://www.rubyslacker.com/?p=91</guid>
		<description><![CDATA[What does this mean? Well for starters, those nice little PCRE shorthands for character classes just don&#8217;t work! So putting this in your Varnish VCL will silently do nothing:

if (req.url ~ "/\d+(/$&#124;/\?&#124;\?&#124;$)") ...

whereas this match: 

if (req.url ~ "/[0-9]+(/$&#124;/\?&#124;\?&#124;$)") ...

Enjoy.
]]></description>
			<content:encoded><![CDATA[<p>What does this mean? Well for starters, those nice little PCRE shorthands for character classes just don&#8217;t work! So putting this in your Varnish VCL will silently do nothing:</p>
<pre>
if (req.url ~ "/\d+(/$|/\?|\?|$)") ...
</pre>
<p>whereas this match: </p>
<pre>
if (req.url ~ "/[0-9]+(/$|/\?|\?|$)") ...
</pre>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hankbeaver.com/index.php/2009/07/14/reminder-to-self-and-world-varnish-uses-posix-regex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
