Re: httpd location statement

2020-12-11 Thread Todd C . Miller
On Fri, 11 Dec 2020 09:54:43 +0200, Alexey Vatchenko wrote:

> Sorry, still don’t understand how captures can help in this case.
> In my understanding, it lacks "OR” to avoid duplicating identical
> location blocks.

Sorry, I misremembered.  You are correct that lua patterns don't
support alternation.

 - todd



Re: httpd location statement

2020-12-10 Thread Alexey Vatchenko
> On 11 Dec 2020, at 00:16, Todd C. Miller  wrote:
> 
> On Thu, 10 Dec 2020 19:24:20 +0200, Alexey Vatchenko wrote:
> 
>> I’m migrating from ancient server with OpenBSD’s apache1 to 6.8 OpenBSD’s htt
>> pd.
>> In my configuration I use Handler for .html, .htm, .css, .js and 4 more exten
>> sions.
>> I’ve found a way to configure it for one extension and it works great!
>> 
>> location “*.html” {
>>fastcgi {
>>socket “/run/slowcgi.sock”
>>param SCRIPT_FILENAME “/path/to/handler.pl"
>>}
>> }
> 
> Can't you just use lua-style patterns with "location match ..."?
> See the CAPTURES section in pattern(7) for details.

Sorry, still don’t understand how captures can help in this case.
In my understanding, it lacks "OR” to avoid duplicating identical location 
blocks.

location “*.html|*.css|*.js” {

}

instead of

location “*.html” {
}
location “*.css” {
}
location “*.js” {
}

Could you please give an example of using captures for this case?



Re: httpd location statement

2020-12-10 Thread Todd C . Miller
On Thu, 10 Dec 2020 19:24:20 +0200, Alexey Vatchenko wrote:

> I’m migrating from ancient server with OpenBSD’s apache1 to 6.8 OpenBSD’s htt
> pd.
> In my configuration I use Handler for .html, .htm, .css, .js and 4 more exten
> sions.
> I’ve found a way to configure it for one extension and it works great!
>
> location “*.html” {
> fastcgi {
> socket “/run/slowcgi.sock”
> param SCRIPT_FILENAME “/path/to/handler.pl"
> }
> }

Can't you just use lua-style patterns with "location match ..."?
See the CAPTURES section in pattern(7) for details.

 - todd



Re: httpd location statement

2020-12-10 Thread Alexey Vatchenko
> On 10 Dec 2020, at 20:51, Florian Obser  wrote:
> 
> I think the only way is to repeat the location statement for each extension :/

If preparing a patch, what is the preferable syntax for this functionality?

location regex “/.*\.(html|css){1}$” {
# something
}



Re: httpd location statement

2020-12-10 Thread Florian Obser
I think the only way is to repeat the location statement for each extension :/

You can leave out the socket since that's the default

On 10 December 2020 18:24:20 CET, Alexey Vatchenko  
wrote:
>Hello!
>
>I’m migrating from ancient server with OpenBSD’s apache1 to 6.8
>OpenBSD’s httpd.
>In my configuration I use Handler for .html, .htm, .css, .js and 4 more
>extensions.
>I’ve found a way to configure it for one extension and it works great!
>
>location “*.html” {
>fastcgi {
>socket “/run/slowcgi.sock”
>param SCRIPT_FILENAME “/path/to/handler.pl"
>}
>}
>
>And I havn't found a way to specify multiple extensions.
>
>Any advice how to do it?
>
>Thanks in advance!

-- 
Sent from a mobile device. Please excuse poor formating.