How about support "long string" in config

agentzh agentzh at
Fri Dec 7 20:29:57 UTC 2012


On Fri, Dec 7, 2012 at 9:01 AM, Maxim Dounin wrote:
>> Strings can also be defined using a long format enclosed by *long brackets*.
>> We define an *opening long bracket of level n* as an opening square bracket
>> followed by *n* equal signs followed by another opening square bracket. So,
>> an opening long bracket of level 0 is written as [[, an opening long
>> bracket of level 1 is written as [=[, and so on. A *closing long bracket* is
>> defined similarly; for instance, a closing long bracket of level 4 is
>> written as ]====]. A long string starts with an opening long bracket of any
>> level and ends at the first closing long bracket of the same level.
>> Literals in this bracketed form can run for several lines, do not interpret
>> any escape sequences, and ignore long brackets of any other level. They can
>> contain anything except a closing bracket of the proper level.
> I don't think we need it.

I believe this feature is great for

1.  inlining source code written in other languages (like Lua or
JavaScript) directly within nginx.conf and also for

2. inlining big chunk of text into directives like "echo" or "return"
to serve static contents directly from memory.

The current string syntax for nginx.conf is cumbersome when there're
many special characters like \ that need escaping.

So I think it'll be a big win for 3rd-party modules :)

Best regards,

More information about the nginx-devel mailing list