Hi,
> Thanks for these clarifications.
>
> On 8 Mar 2016, at 12:40, Peter Bex wrote:
>
>> On Tue, Mar 08, 2016 at 12:02:29PM +0000, Norman Gray wrote:
>>> It occurred to me that I could/should use the vhost-map to do this
>>> dispatching, using something like
>>>
>>> (vhost-map `((".*" . ,(lambda (continue) ... and ignore (continue)))))
>>>
>>> But (a) that would clearly be a hack
>>
>> Actually, that's how it was designed to be used. Not a hack at all!
This is how we do things in Knodium as well and it works a treat.
> Ah!
>
>>> and (b) it appears that that's designed to be able to re-parameterise
>>> a request, rather than handle it itself,
>>
>> It's intended to be used like that, and you *may* re-parameterise (but
>> that's not necessary). The idea is that you can create "components"
>> which can be chained together, influencing their sub-components by
>> simply parameterising some options and then passing the flow on to
>> continue. The last component in the sequence would then actually
>> serve the request.
>
> So you mean including handlers like:
>
> (define (vhost-handler cont)
> (let ((uri (uri-path (request-uri (current-request)))))
> (if (string=? (cadr uri) "wibble") ;; we want to handle URIs like
> /wibble/...
> (send-response status: 'ok
> body: (format "<p>Good: request was ~S
> (vhost)</p>" uri)
> headers: '((content-type text/html)))
> (cont))))
> (vhost-map `((".*" . ,vhost-handler)))
>
> OK: that's a (very) nice design -- I'll do that.
We use the uri-match egg to do our routing rather than decomposing the
uri by hand. (http://api.call-cc.org/doc/uri-match )
Regards,
@ndy
--
[email protected]
http://www.ashurst.eu.org/
0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users