RE: draft-snell-http-prefer

On 2011-10-17 at 17:26:30, James Snell wrote:
> A third case that has come up (albeit purely experimental at this
> stage) involves the use of Prefer in cometd/long-polling scenarios...
> essentially using it as a mechanism for indicating whether the client 
> would like the server to return a response immediately or hold the 
> connection until a response is available without requiring the use of 
> a query string parameters in the request URI. For instance,
> 
> GET /my_uri HTTP/1.1
> Prefer: no-wait
> 
> vs.
> 
> GET /my_uri HTTP/1.1
> Prefer: wait
> 
> Again, the server is obviously free to do what it wants, but in this 
> particular scenario, when the server received a no-wait preference, it 
> returned immediately without holding the connection regardless of 
> whether there was any data to return. When receiving a "wait"
> preference, on the other hand, the connection would be held until data 
> became available or until a certain server specified period of time 
> had passed.


Hi James,

I've been looking at this for a little while and I think that you could address both with an (optional) parameter that sets an upper bound on the wait interval.  This indicates that after this time, the client is likely to close the connection.  I've found some cases where knowing the time limit can affect what the server does in order to produce a result.

Prefer: wait=0 is then equivalent to no-wait.  We've found that being able to set a limit on the wait time is quite useful.  A server (or intermediary) that was aware of the prefer option can then generate a response prior to this time elapsing.

--Martin

Received on Monday, 17 October 2011 06:40:44 UTC