This very specific VCL extension to parse and normalize Accept-Language
headers is becoming more robust as time goes by. Here's the latest round of fixes:
- the original
req.http.Accept-Language
header could be overwritten when calling thevcl_rewrite_accept_language()
function. Now this is fixed by copying the original header string into a static buffer and executing the processing on the copy. - improved a bit the style of the C code in a few places. Nothing miraculous really. Feels improved for me at least :)
- fixed the use of a wrong define (string max length instead of languages list max length)
- use of
sizeof
instead of using same constants instrncpy
, etc… - 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's that supposed to do, and where it came from :)
Enough blah blah, here's the new code. If you were already running this piece of VCL, then I won't tell you this is experimental stuff, because at this point it's no more experimental. But if you were running it already, then by all means upgrade. It is definitely better :)
http://github.com/cosimo/varnish-accept-language
Enjoy!