How can I write a server side script which talks with a 32U4 sketch?

My question is doublefold:
(a) how to configure uhttp to start a server side script (SSS)?
(b) how to send something from SSS to the LININO side of the Bridge for final deliver to the sketch?
As for the (a) part of the question: I have some experience in writing and setting to work PHP scripts under Apache, but here we have uhttpd, which seems to have a different configuration philosophy; moreover I would prefer a solution similar to the REST as already implemented, and I need to do some processing before going to the skecth... I googled for a couple of days with no luck.. and I could not understand the mechanism by which (apparently) a certain frontend is called for any URL starting with http://<arduino_node>/arduino .. (apparently uhttpd does not support Rewrite rules, that could make this possible).
(b) On a book I found a pictures implying that the communication between uhttpd and 32U4 passes trough LuCI and then via sockets TCP 5555 and TCP 5700. I suspect this is not correct; perhaps more knowledge about the existing architecture would help me, but I have not been able to find documentation, or to understand which kilograms of the existings tons of code to examine..

http://forum.arduino.cc/index.php?topic=228783.0

Many thanks! I think this is a good answer to my question.
Perhaps you may also address me to some explanation of how the REST is implemented in Yùn? I like, when possible, to gain deeper insight on how the things works; I understand how could be possible to have a single script that takes care of GET requests for more than one URL (as it is done in the REST example); but only if we had something like Apache, for example:

  • we want to process with a single script all URLs of type http://myserver.com/myapp/, regardles of what the string is;
  • Apache, following a rewriting rule in its configuration, changes all these URLS in http://myserver.com/myappfrontend.php;
  • Apache therefore executes myappfrontend.php, but passes to it the original URL
  • myappfrontend.php parses the original URL, looking - in particular - to the string ; dynamically builds a page (appropriate for the request) and returns it to the server, which returns the page to the client
    I think REST in Yùn is implemented in a not too different way; but we have no Apache in Yùn, we have uhttpd, which - as far as I know - does not support rewriting rules... then: how is this handled?

yes; but I had already read the Bridge tutorial; it explains that certain requests to the uhttpd are routed to the sketch, but it does not explain how this is done behind the scene.. i.e. who is routing from uhttpd to the sketch (I suppose some lua or python script, I would like to know the file name and location, so I could read it) and how this "who" (the script) is invoked for any URL that has "arduino" after the IP domain name... but I have not been abke to discover, even if I have read the uhttpd documentation that I could find (in the OpenWRT site)