winlin

fix fms token traverse bug, always update the token by the latest valid client.

... ... @@ -439,7 +439,14 @@ int SrsSource::find(SrsRequest* req, SrsSource** ppsource)
srs_info("create new source for url=%s, vhost=%s", stream_url.c_str(), vhost.c_str());
}
*ppsource = pool[stream_url];
// we always update the request of resource,
// for origin auth is on, the token in request maybe invalid,
// and we only need to update the token of request, it's simple.
if (true) {
SrsSource* source = pool[stream_url];
source->_req->update_auth(req);
*ppsource = source;
}
return ret;
}
... ...
... ... @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "130"
#define VERSION_REVISION "131"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
... ...
... ... @@ -108,6 +108,22 @@ SrsRequest* SrsRequest::copy()
return cp;
}
void SrsRequest::update_auth(SrsRequest* req)
{
pageUrl = req->pageUrl;
swfUrl = req->swfUrl;
tcUrl = req->tcUrl;
if (args) {
srs_freep(args);
}
if (req->args) {
args = req->args->copy()->to_object();
}
srs_info("update req of soruce for auth ok");
}
int SrsRequest::discovery_app()
{
int ret = ERROR_SUCCESS;
... ...
... ... @@ -89,6 +89,13 @@ public:
* when reload it, the request maybe invalid, so need to copy it.
*/
virtual SrsRequest* copy();
/**
* update the auth info of request,
* to keep the current request ptr is ok,
* for many components use the ptr of request.
*/
virtual void update_auth(SrsRequest* req);
/**
* disconvery vhost/app from tcUrl.
... ...