My request is to cache the PUT parameters of a request.
The way the PUT parameters are currently being read is by parsing the php://input stream (see the implementation)
According to the php documentation regarding the php://input stream, this stream can be read only once (pay attention to the NOTE section in the php documentation).
My tests have also shown that I can successfully get the PUT params once, but not twice, by calling:
I am developing a Yii based REST based web service and I want to implement authentication. Part of my authentication scheme (which imitates the authentication used in the Amazon AWS REST API calls) is to calculate a signature of the incoming request parameters (among other things).
This requires me to get the PUT parameters ONCE during the authentication process (done in a filter that runs before my controller) and then a SECOND time during the implementation of the PUT request.
Unfortunately, by the time the actual PUT request gets it’s opportunity to execute, I have lost access to the PUT parameters (since they are consumed by the authentication check).
I would suggest that the PUT parameters are cached, during their first request, and then served from the cached variable in any subsequent requests.
I could also cache the PUT parameters somewhere in my application (something I am trying to work on now) but I think that this should be a responsibility of the framework and not mine.
Hopefully, I have not misread the documentation and it would be quite embarrassing if there IS a way to repeatedly get the PUT parameters.
I welcome any suggestions on alternative ways to approach this situation.