{"id":464,"date":"2010-11-18T23:37:27","date_gmt":"2010-11-18T22:37:27","guid":{"rendered":"http:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/"},"modified":"2010-11-18T23:37:27","modified_gmt":"2010-11-18T22:37:27","slug":"another-round-of-fixes-for-the-varnish-accept-language-vcl-extension","status":"publish","type":"post","link":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/","title":{"rendered":"Another round of fixes for the varnish Accept-Language VCL extension"},"content":{"rendered":"<p>This <a href=\"\/cstrep\/blog\/index.dml\/tag\/varnish\" rel=\"nofollow\">very specific VCL extension<\/a> to parse and normalize <code>Accept-Language<\/code> headers is becoming more robust as time goes by. Here&#39;s the latest round of fixes:<\/p>\n<ul>\n<li>the original <code>req.http.Accept-Language<\/code> header could be overwritten when calling the <code>vcl_rewrite_accept_language()<\/code> function. Now this is fixed by copying the original header string into a static buffer and executing the processing on the copy.<\/li>\n<li>improved a bit the style of the C code in a few places. Nothing miraculous really. Feels improved for me at least :)<\/li>\n<li>fixed the use of a wrong define (string max length instead of languages list max length)<\/li>\n<li>use of <code>sizeof<\/code> instead of using same constants in <code>strncpy<\/code>, etc&#8230;<\/li>\n<li>added a small intro on the generated file too. In this way, if you find the code on some server, you can immediately understand what&#39;s that supposed to do, and where it came from :)\n<\/li>\n<\/ul>\n<p>Enough blah blah, here&#39;s the new code. If you were already running this piece of VCL, then I won&#39;t tell you this is experimental stuff, because at this point it&#39;s no more experimental. But if you were running it already, then by all means upgrade. It is definitely better :)<\/p>\n<p><a href=\"http:\/\/github.com\/cosimo\/varnish-accept-language\" rel=\"nofollow\">http:\/\/github.com\/cosimo\/varnish-accept-language<\/a><\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This very specific VCL extension to parse and normalize Accept-Language headers is becoming more robust as time goes by. Here&#39;s the latest round of fixes: the original req.http.Accept-Language header could be overwritten when calling the vcl_rewrite_accept_language() function. Now this is fixed by copying the original header string into a static buffer and executing the processing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[265,91,357,148,63,358,60,48],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Another round of fixes for the varnish Accept-Language VCL extension - Random hacking<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Another round of fixes for the varnish Accept-Language VCL extension - Random hacking\" \/>\n<meta property=\"og:description\" content=\"This very specific VCL extension to parse and normalize Accept-Language headers is becoming more robust as time goes by. Here&#039;s the latest round of fixes: the original req.http.Accept-Language header could be overwritten when calling the vcl_rewrite_accept_language() function. Now this is fixed by copying the original header string into a static buffer and executing the processing [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/\" \/>\n<meta property=\"og:site_name\" content=\"Random hacking\" \/>\n<meta property=\"article:published_time\" content=\"2010-11-18T22:37:27+00:00\" \/>\n<meta name=\"author\" content=\"cosimo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"cosimo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/\"},\"author\":{\"name\":\"cosimo\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"headline\":\"Another round of fixes for the varnish Accept-Language VCL extension\",\"datePublished\":\"2010-11-18T22:37:27+00:00\",\"dateModified\":\"2010-11-18T22:37:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/\"},\"wordCount\":206,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"keywords\":[\"accept-language\",\"development\",\"drupal\",\"fun\",\"github\",\"http\",\"varnish\",\"web\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/\",\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/\",\"name\":\"Another round of fixes for the varnish Accept-Language VCL extension - Random hacking\",\"isPartOf\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#website\"},\"datePublished\":\"2010-11-18T22:37:27+00:00\",\"dateModified\":\"2010-11-18T22:37:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.streppone.it\/cosimo\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Another round of fixes for the varnish Accept-Language VCL extension\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#website\",\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/\",\"name\":\"Random hacking\",\"description\":\"Assume nothing. Code defensively. Keep it simple, stupid!\",\"publisher\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.streppone.it\/cosimo\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\",\"name\":\"cosimo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g\",\"caption\":\"cosimo\"},\"logo\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/author\/cosimo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Another round of fixes for the varnish Accept-Language VCL extension - Random hacking","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/","og_locale":"en_US","og_type":"article","og_title":"Another round of fixes for the varnish Accept-Language VCL extension - Random hacking","og_description":"This very specific VCL extension to parse and normalize Accept-Language headers is becoming more robust as time goes by. Here&#39;s the latest round of fixes: the original req.http.Accept-Language header could be overwritten when calling the vcl_rewrite_accept_language() function. Now this is fixed by copying the original header string into a static buffer and executing the processing [&hellip;]","og_url":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/","og_site_name":"Random hacking","article_published_time":"2010-11-18T22:37:27+00:00","author":"cosimo","twitter_card":"summary_large_image","twitter_misc":{"Written by":"cosimo","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/#article","isPartOf":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/"},"author":{"name":"cosimo","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"headline":"Another round of fixes for the varnish Accept-Language VCL extension","datePublished":"2010-11-18T22:37:27+00:00","dateModified":"2010-11-18T22:37:27+00:00","mainEntityOfPage":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/"},"wordCount":206,"commentCount":0,"publisher":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"keywords":["accept-language","development","drupal","fun","github","http","varnish","web"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/","url":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/","name":"Another round of fixes for the varnish Accept-Language VCL extension - Random hacking","isPartOf":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#website"},"datePublished":"2010-11-18T22:37:27+00:00","dateModified":"2010-11-18T22:37:27+00:00","breadcrumb":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/11\/another-round-of-fixes-for-the-varnish-accept-language-vcl-extension\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.streppone.it\/cosimo\/blog\/"},{"@type":"ListItem","position":2,"name":"Another round of fixes for the varnish Accept-Language VCL extension"}]},{"@type":"WebSite","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#website","url":"https:\/\/www.streppone.it\/cosimo\/blog\/","name":"Random hacking","description":"Assume nothing. Code defensively. Keep it simple, stupid!","publisher":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.streppone.it\/cosimo\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1","name":"cosimo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g","caption":"cosimo"},"logo":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/"},"url":"https:\/\/www.streppone.it\/cosimo\/blog\/author\/cosimo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts\/464"}],"collection":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/comments?post=464"}],"version-history":[{"count":0,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts\/464\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/media?parent=464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/categories?post=464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/tags?post=464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}