[plt-scheme] Re: url rewriting

From: kanishka (nish2575 at yahoo.com)
Date: Fri Jun 8 00:54:55 EDT 2007

i believe there is an old thread in this mailing list which references
someone using apache and mod_rewrite as a front end server to plt....

A little while back, I had gotten through reading about half of the
implementation code for the 352 version of the web server. i remember
reading about how it runs a sequence of dispatchers for logging,
authentication, running the servlet, etc.

This seems similar to Apache's 18 or 19 (fixed) call out points in the
process of handling a request. i believe most programs using a mod_*
language only make use of the plug in point for producing the http
response.

anyways, just curious to hear any thoughts you have on Unlib's
pipelines (where each stage/function in the pipeline is given the
continuation that it may or may not choose to call) versus this
dispatcher architecture.

i'm wondering if exposing a pipeline interface out of the server would
provide even more power to the developer? i'm guessing the dispatchers
run in sequence every time, possibly with the option to signal a fatal
error to stop the rest of the sequence from running.


Jay, 

another minor unrelated note, from developing with the 352 web
server(which as always i love), one especially annoying behavior is if
you accidentally provide malformed sxml, when invoking the servlet, it
runs endlessly instead of reporting an error to the client. another is
wondering where the errors from misbehaving servlet are logged if
anywhere (I haven't done much digging to see if its in an obvious
place)

also...on your continuation advice from before, i haven't tried it yet,
but will soon. i'm still hand rolling my scheme and javascript
continuation points. leaning towards macros like:
(def-scheme function-name arguments environment body)
(def-js function-name arguments environment body)
which generate the definitions with the (lambda (env) (lambda (args)
... )) as well as stub functions for calling from scheme to javascript
or vice versa. automates some grunt work, without taking too much
control away from the developer..also haven't had time to really read
the continuation mark based algorithm yet.

kanishka

>>
From: Jay McCarthy <jay.mccarthy at ...>
Subject: Re: url rewriting
Newsgroups: gmane.lisp.scheme.plt
Date: 2007-06-07 23:53:07 GMT (4 hours and 40 minutes ago)

Yes, it is possible.

Implement a custom dispatcher [1] that does the rewriting, then use
your own dispatching sequencing and put the rewriting dispatcher at
the start. Everything "will just work". Send me the code and I can
then integrate it. Basically you want:

; make : (url? -> url?) (conn? req? -> void) -> (conn? req? -> void)
(define (make url->url inner)
 (lambda (conn req)
  (inner conn (update-request-url req (url->url (request-url req))))))

Jay

1. See new documentation, in SVN after `mzscheme -mvt
docs/doc-installer.ss' or online at:

http://jay.teammccarthy.org/tmp/web-server-reference/dispatchers.html#(part%20dispatchers)
>>


Posted on the users mailing list.