Alex Rousskov wrote:
There is a fine line here, of course. In may cases, selecting a good
candidate would require looking at the body. For example, a P module
that guesses content type would do that. Without such a module, one
would have to pass virtually everything to the content-type-specific
service because Content-Type headers are often missing or wrong. Note
that the said P module would only need to look at a few first bytes of
the content.
I am not ready to cast my vote here. I think we need to consider more
use cases. How, for example, do you propose to handle a case where a
callout service wants to adapt all GIF images. and only them? We can
assume HTTP application protocol for now.
One approach would be to write a P program that forwards only those HTTP
responses to the service that do not have a content type of "text/*".
This should significantly reduce the number of unnecessary service
invocations. But I agree that in this example it may make sense to give
a P program access to the first few bytes of the message body. This
would still be a small object, though. Do you have an example that would
require the handling of large objects?
Also, it seems that your suggestion is based on an assumption that
bodies are large and headers are small. This is usually true for HTTP,
but may not be true for other application protocols. If we go down
this path, how would you define X in "P programs should not be allowed
to reference X"? Would it be application binding specific?
Generally speaking, I would say that P programs should be restricted to
the evaluation of signaling/control and meta data which is all typically
contained in message headers. I also think that it's safe to assume that
signaling/control/meta data is typically smaller than the data it is
assciated with. In practice, I think we should look at those message
properties that OPES processors need to inspect for their normal
operation anyway. For example, do Web caches typically look at HTTP
bodies in order to decide whether or not to cache an object? If not,
then maybe this would be a message property that should rather be
inspected by an OPES service application running on a dedicated and
specialized callout server. I think whenever the evaluation of a
property is likely to be expensive and could therefore interfere with
the normal operation of an OPES processor, then we should disallow this
operation in P.
-Andre