diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index f90e7f17..795544b8 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -2170,6 +2170,14 @@ UnrealScript: extensions: - .uc +VCL: + type: programming + lexer: Perl + ace_mode: perl + color: "#0298c3" + extensions: + - .vcl + VHDL: type: programming lexer: vhdl diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index 939b6403..9cbfceb0 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -615,6 +615,9 @@ "UnrealScript": [ ".uc" ], + "VCL": [ + ".vcl" + ], "Verilog": [ ".v" ], @@ -734,8 +737,8 @@ ".gemrc" ] }, - "tokens_total": 613712, - "languages_total": 802, + "tokens_total": 614257, + "languages_total": 804, "tokens": { "ABAP": { "*/**": 1, @@ -63723,6 +63726,87 @@ "log": 1, "defaultproperties": 1 }, + "VCL": { + "sub": 23, + "vcl_recv": 2, + "{": 50, + "if": 14, + "(": 50, + "req.request": 18, + "&&": 14, + ")": 50, + "return": 33, + "pipe": 4, + ";": 48, + "}": 50, + "pass": 9, + "req.http.Authorization": 2, + "||": 4, + "req.http.Cookie": 2, + "lookup": 2, + "vcl_pipe": 2, + "vcl_pass": 2, + "vcl_hash": 2, + "set": 10, + "req.hash": 3, + "+": 17, + "req.url": 2, + "req.http.host": 4, + "else": 3, + "server.ip": 2, + "hash": 2, + "vcl_hit": 2, + "obj.cacheable": 2, + "deliver": 8, + "vcl_miss": 2, + "fetch": 3, + "vcl_fetch": 2, + "obj.http.Set": 1, + "-": 21, + "Cookie": 2, + "obj.prefetch": 1, + "s": 3, + "vcl_deliver": 2, + "vcl_discard": 1, + "discard": 2, + "vcl_prefetch": 1, + "vcl_timeout": 1, + "vcl_error": 2, + "obj.http.Content": 2, + "Type": 2, + "synthetic": 2, + "utf": 2, + "//W3C//DTD": 2, + "XHTML": 2, + "Strict//EN": 2, + "http": 3, + "//www.w3.org/TR/xhtml1/DTD/xhtml1": 2, + "strict.dtd": 2, + "obj.status": 4, + "obj.response": 6, + "req.xid": 2, + "//www.varnish": 1, + "cache.org/": 1, + "req.restarts": 1, + "req.http.x": 1, + "forwarded": 1, + "for": 1, + "req.http.X": 3, + "Forwarded": 3, + "For": 3, + "client.ip": 2, + "hash_data": 3, + "beresp.ttl": 2, + "<": 1, + "beresp.http.Set": 1, + "beresp.http.Vary": 1, + "hit_for_pass": 1, + "obj.http.Retry": 1, + "After": 1, + "vcl_init": 1, + "ok": 2, + "vcl_fini": 1 + }, "Verilog": { "////////////////////////////////////////////////////////////////////////////////": 14, "//": 117, @@ -66969,6 +67053,7 @@ "TXL": 213, "TypeScript": 109, "UnrealScript": 2873, + "VCL": 545, "Verilog": 3778, "VHDL": 42, "VimL": 20, @@ -67157,6 +67242,7 @@ "TXL": 1, "TypeScript": 3, "UnrealScript": 2, + "VCL": 2, "Verilog": 13, "VHDL": 1, "VimL": 2, @@ -67173,5 +67259,5 @@ "Zephir": 2, "Zimpl": 1 }, - "md5": "4754c31a712c5e22354851fd14d4d4fa" + "md5": "e69777074750ed98faadf08497ba6339" } \ No newline at end of file diff --git a/samples/VCL/varnish2_default.vcl b/samples/VCL/varnish2_default.vcl new file mode 100644 index 00000000..9b01881f --- /dev/null +++ b/samples/VCL/varnish2_default.vcl @@ -0,0 +1,152 @@ +/*- + * Copyright (c) 2006 Verdens Gang AS + * Copyright (c) 2006-2008 Linpro AS + * All rights reserved. + * + * Author: Poul-Henning Kamp + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + * + * The default VCL code. + * + * NB! You do NOT need to copy & paste all of these functions into your + * own vcl code, if you do not provide a definition of one of these + * functions, the compiler will automatically fall back to the default + * code from this file. + * + * This code will be prefixed with a backend declaration built from the + * -b argument. + */ + +sub vcl_recv { + if (req.request != "GET" && + req.request != "HEAD" && + req.request != "PUT" && + req.request != "POST" && + req.request != "TRACE" && + req.request != "OPTIONS" && + req.request != "DELETE") { + /* Non-RFC2616 or CONNECT which is weird. */ + return (pipe); + } + if (req.request != "GET" && req.request != "HEAD") { + /* We only deal with GET and HEAD by default */ + return (pass); + } + if (req.http.Authorization || req.http.Cookie) { + /* Not cacheable by default */ + return (pass); + } + return (lookup); +} + +sub vcl_pipe { + # Note that only the first request to the backend will have + # X-Forwarded-For set. If you use X-Forwarded-For and want to + # have it set for all requests, make sure to have: + # set req.http.connection = "close"; + # here. It is not set by default as it might break some broken web + # applications, like IIS with NTLM authentication. + return (pipe); +} + +sub vcl_pass { + return (pass); +} + +sub vcl_hash { + set req.hash += req.url; + if (req.http.host) { + set req.hash += req.http.host; + } else { + set req.hash += server.ip; + } + return (hash); +} + +sub vcl_hit { + if (!obj.cacheable) { + return (pass); + } + return (deliver); +} + +sub vcl_miss { + return (fetch); +} + +sub vcl_fetch { + if (!obj.cacheable) { + return (pass); + } + if (obj.http.Set-Cookie) { + return (pass); + } + set obj.prefetch = -30s; + return (deliver); +} + +sub vcl_deliver { + return (deliver); +} + +sub vcl_discard { + /* XXX: Do not redefine vcl_discard{}, it is not yet supported */ + return (discard); +} + +sub vcl_prefetch { + /* XXX: Do not redefine vcl_prefetch{}, it is not yet supported */ + return (fetch); +} + +sub vcl_timeout { + /* XXX: Do not redefine vcl_timeout{}, it is not yet supported */ + return (discard); +} + +sub vcl_error { + set obj.http.Content-Type = "text/html; charset=utf-8"; + synthetic {" + + + + + "} obj.status " " obj.response {" + + +

Error "} obj.status " " obj.response {"

+

"} obj.response {"

+

Guru Meditation:

+

XID: "} req.xid {"

+
+
+ Varnish cache server +
+ + +"}; + return (deliver); +} diff --git a/samples/VCL/varnish3_default.vcl b/samples/VCL/varnish3_default.vcl new file mode 100644 index 00000000..412b6e94 --- /dev/null +++ b/samples/VCL/varnish3_default.vcl @@ -0,0 +1,149 @@ +/*- + * Copyright (c) 2006 Verdens Gang AS + * Copyright (c) 2006-2011 Varnish Software AS + * All rights reserved. + * + * Author: Poul-Henning Kamp + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The default VCL code. + * + * NB! You do NOT need to copy & paste all of these functions into your + * own vcl code, if you do not provide a definition of one of these + * functions, the compiler will automatically fall back to the default + * code from this file. + * + * This code will be prefixed with a backend declaration built from the + * -b argument. + */ + +sub vcl_recv { + if (req.restarts == 0) { + if (req.http.x-forwarded-for) { + set req.http.X-Forwarded-For = + req.http.X-Forwarded-For + ", " + client.ip; + } else { + set req.http.X-Forwarded-For = client.ip; + } + } + if (req.request != "GET" && + req.request != "HEAD" && + req.request != "PUT" && + req.request != "POST" && + req.request != "TRACE" && + req.request != "OPTIONS" && + req.request != "DELETE") { + /* Non-RFC2616 or CONNECT which is weird. */ + return (pipe); + } + if (req.request != "GET" && req.request != "HEAD") { + /* We only deal with GET and HEAD by default */ + return (pass); + } + if (req.http.Authorization || req.http.Cookie) { + /* Not cacheable by default */ + return (pass); + } + return (lookup); +} + +sub vcl_pipe { + # Note that only the first request to the backend will have + # X-Forwarded-For set. If you use X-Forwarded-For and want to + # have it set for all requests, make sure to have: + # set bereq.http.connection = "close"; + # here. It is not set by default as it might break some broken web + # applications, like IIS with NTLM authentication. + return (pipe); +} + +sub vcl_pass { + return (pass); +} + +sub vcl_hash { + hash_data(req.url); + if (req.http.host) { + hash_data(req.http.host); + } else { + hash_data(server.ip); + } + return (hash); +} + +sub vcl_hit { + return (deliver); +} + +sub vcl_miss { + return (fetch); +} + +sub vcl_fetch { + if (beresp.ttl <= 0s || + beresp.http.Set-Cookie || + beresp.http.Vary == "*") { + /* + * Mark as "Hit-For-Pass" for the next 2 minutes + */ + set beresp.ttl = 120 s; + return (hit_for_pass); + } + return (deliver); +} + +sub vcl_deliver { + return (deliver); +} + +sub vcl_error { + set obj.http.Content-Type = "text/html; charset=utf-8"; + set obj.http.Retry-After = "5"; + synthetic {" + + + + + "} + obj.status + " " + obj.response + {" + + +

Error "} + obj.status + " " + obj.response + {"

+

"} + obj.response + {"

+

Guru Meditation:

+

XID: "} + req.xid + {"

+
+

Varnish cache server

+ + +"}; + return (deliver); +} + +sub vcl_init { + return (ok); +} + +sub vcl_fini { + return (ok); +}