[plt-scheme] send/suspend: when the response relies on the request

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Aug 13 10:29:18 EDT 2005

On Aug 13, 2005, at 5:08 AM, Dave Herman wrote:

>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> The type of send/suspend is (string -> response) -> request, which 
> means that the continuation argument must create a response without 
> seeing the request. But sometimes you need to see the request bindings 
> to generate the response properly.

You are misreading the type here. The type means:
  give me a function that given a string, generates a response to the 
_current_ request
  then I (send/suspend) will produce the next request (if any)

Remember that this function can only be invoked if the consumer has 
triggered the start "entry" into this script. This creates an initial 
request and somehow this request should be shuffled into the function 
that creates a response for send/suspend.

-- Matthias

P.S. Jay's example makes this concrete. I thought I'd add an abstract 

> A common example is that XHTML is supposed to be generated with the 
> Content-type: application/xhtml+xml, but only if the client browser 
> sends an HTTP_ACCEPT binding (in the request) that includes that MIME 
> type. So you need to be able to view the request bindings in order to 
> generate a Content-type header in the response with 
> make-response/full.
> Is there any way to do this?
> Thanks,
> Dave

Posted on the users mailing list.