When an iPhone, or generally a Cupertino based client starts playing a stream, my module's public void onHTTPSessionCreate(IHTTPStreamerSession httpSession) method is invoked twice. My authentication method is not idempotent, so for some reason the second time the session is refused.
I am trying to find a way to treat these two connections as one, but I am not finding the common points in the two consequtive requests. Of course the IP and the user-agent is the same, but I am looking for something better. It would also do for me if I could differentiate between the two calls and only process one of them, I guess there should be a protocol related command hidden inside.
The most common method for this is to add a query parameter which is unique to the connection and perform a redirect back to the client. The client then makes another connection and both requests have the additional query parameter so can be tied together.
The reason for the two connections is commonly due to the use of <a href> links rather than a html5 video tag. The first connection requests a playlist and the second connection is the media player within iOS actually requesting the chunks and playing the content.