On 13-ene-09, at 18:56, Iván Chavero wrote:
> On Tue, 13 Jan 2009 07:00:44 -0600, Gunnar Wolf <[email protected]>  
> wrote:
>
>> This looks really sweet! Cherokee guys, do you think it is possible  
>> to
>> include Ivan's scripts in contrib/ ? This will surely help many  
>> people
>> decide and do the switch - specially so if it is enhanced to cope as
>> well with .htaccess files, often not written by or even understood by
>> sysadmins but by the application authors.
>
> Currently it only migrates the apache directives that define the  
> virtual
> host, i don't know how hard (or possible) it could be to migrate stuff
> commonly found on .htaccess files like mod_rewrite directives.  
> Besides that
> the script can be easily extended to migrate most of the "Name Value"
> apache directives that can be mapped to the cherokee config file.


<!-- WARNING --><technical>

The only way to get an Apache configuration file converted would be to  
write a translator. It'd be something similar to a natural language  
translator - but slightly more complex, actually.

The first piece of the puzzle would be a lex scanner, so the program  
can read the pseudo-XML that the Apache configuration files are based  
on. That would read, identity an return tokens.

Then, all those tokens would have to be kept into memory, so a whole  
configuration structure can be built based on them. This part is quite  
straightforward.

The next step would be quite tough, though. At this stage it'd have to  
read the Apache configuration file, so it can sort of 'understand'  
what it's actually meaning. Once it got a complete piece of  
information, it'd have to translate it and add it to the Cherokee  
configuration tree.  Beware; even if this step doesn't look hard, it'd  
become really complex eventually. There will be times when those  
translations will require processing.

Finally, when the Cherokee configuration tree is completed in memory,  
it'd have to write it down (a trivial final task).

<!-- WARNING --></technical>

So, I'd personally wouldn't try to write a translator without  
following this sort of lexical/syntactic parser scheme. Doing so would  
be a hell of a work, but IMHO it's the only way to success.

--
Octality
http://www.octality.com/

_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee

Reply via email to