onHTTPSessionCreate does not trigger

Hi,

I found a problem in wowza.

We set up a live-origin-edge service with wowza.

If user play url like “http://[edgeServerIP]/live/myStream/playlist.m3u8?wowzasessionid=xxxxx”

It will not trigger onHTTPSessionCreate.

The log is

INFO server comment - onAppStart: live/_definst_
INFO application app-start _definst_ live/_definst_
INFO server comment - onStreamCreate
INFO stream create - -
INFO server comment - MediaStreamHTTPStreamerRepeaterBuffer.initLiveStreamRepeating: receiverClass: com.wowza.wms.httpstreamer.cupertinostreaming.liverepeater.CupertinoStreamerLiveRepeaterReceiver
INFO server comment - onPublish
INFO server comment - LiveMediaStreamReceiver.connect: rtmp://[originServerIP]:1935/live/_definst_/myStream
INFO server comment - CupertinoStreamerLiveRepeaterReceiver.close: live/_definst_/myStream:myStream:cupertinostreamingpacketizer
INFO server comment - CupertinoStreamerLiveRepeaterReceiver.resetStream: live/_definst_/myStream:cupertinostreamingpacketizer
INFO server comment - onStreamCreate
INFO server comment - CupertinoStreamerLiveRepeaterReceiver.initLiveStreamPacketizer: live/_definst_/myStream:myStream:cupertinostreamingpacketizer
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/myStream]: chunkDurationTarget: 10000
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/myStream]: chunkDurationTolerance: 500
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/myStream]: audioGroupCount: 3
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/myStream]: playlistChunkCount:3
INFO server comment - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: cupertinostreamingpacketizer:myStream
INFO cupertino connect 235766135 -
INFO server comment - onStreamCreate
INFO server comment - MediaStreamHTTPStreamerRepeaterPlay: startPlay
INFO stream create rtmp://[originServerIP]:1935/live/_definst_/myStream
INFO stream play rtmp://[originServerIP]:1935/live/_definst_/myStream

If user play url like “http://[edgeServerIP]/live/myStream/playlist.m3u8”

It works fine.

The log is

INFO server comment - onAppStart: live/_definst_
INFO application app-start _definst_ live/_definst_
INFO server comment - onStreamCreate
INFO stream create - -
INFO server comment - MediaStreamHTTPStreamerRepeaterBuffer.initLiveStreamRepeating: receiverClass: com.wowza.wms.httpstreamer.cupertinostreaming.liverepeater.CupertinoStreamerLiveRepeaterReceiver
INFO server comment - onPublish
INFO server comment - LiveMediaStreamReceiver.connect: rtmp://[originServerIP]:1935/live/_definst_/myStream
INFO server comment - CupertinoStreamerLiveRepeaterReceiver.close: live/_definst_/myStream:myStream:cupertinostreamingpacketizer
INFO server comment - CupertinoStreamerLiveRepeaterReceiver.resetStream: live/_definst_/myStream:cupertinostreamingpacketizer
INFO server comment - onStreamCreate
INFO server comment - CupertinoStreamerLiveRepeaterReceiver.initLiveStreamPacketizer: live/_definst_/myStream:myStream:cupertinostreamingpacketizer
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/myStream]: chunkDurationTarget: 10000
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/myStream]: chunkDurationTolerance: 500
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/myStream]: audioGroupCount: 3
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/myStream]: playlistChunkCount:3
INFO server comment - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: cupertinostreamingpacketizer:myStream
INFO cupertino connect 1949153657 -
INFO server comment - onStreamCreate
INFO server comment - MediaStreamHTTPStreamerRepeaterPlay: startPlay
INFO stream create rtmp://[originServerIP]:1935/live/_definst_/myStream
INFO server comment - onHTTPSessionCreate: 1949153657
INFO server comment - onHTTPCupertinoStreamingSessionCreate: 1949153657
WARN server comment - reject session id: 1949153657
WARN server comment - HTTPStreamerAdapterCupertinoStreamer.onPlaylist[live/myStream/playlist.m3u8]: Session not accepted[1949153657]

Since we authorize our user in onHTTPCupertinoStreamingSessionCreate event handler, it will cause we cannot reject illegal user if they take wowzasessionid in query string.

Thanks,

Roy

Roy,

In my test, adding wowzasessionid did not have that affect. onHTTPSessionCreate did run. I compiled this:

package test;
import com.wowza.wms.httpstreamer.model.IHTTPStreamerSession;
import com.wowza.wms.module.*;
import com.wowza.wms.application.*;
public class ModuleAccessControlHTTPStreaming extends ModuleBase
{
	public void onHTTPSessionCreate(IHTTPStreamerSession httpSession)
	{
		boolean isGood = true;
		
		String ipAddressClient = httpSession.getIpAddress();
		String ipAddressServer = httpSession.getServerIp();
		String queryStr = httpSession.getQueryStr();
		String referrer = httpSession.getReferrer();
		String cookieStr = httpSession.getCookieStr();
		String userAgent = httpSession.getUserAgent();
		
		IApplicationInstance appInstance = httpSession.getAppInstance();
		String streamName = httpSession.getStreamName();
		
		// Here you can use the request and session information above to determine 
		// if you want to reject the connection
		// isGood = true/false;
		
		getLogger().info("ModuleAccessControlHTTPStreaming.onHTTPSessionCreate["+appInstance.getContextStr()+":"+streamName+"]: accept:"+isGood);
		
		if (!isGood)
			httpSession.rejectSession();
	}
}

And added this module to /conf/vod/Application.xml for my test:

<Module>
	<Name>ModuleAccessControlHTTPStreaming</Name>
	<Description>ModuleAccessControlHTTPStreaming</Description>
	<Class>test.ModuleAccessControlHTTPStreaming</Class>
</Module> 

I ran with and without wowzasessionid and both times see “INFO server comment - ModuleAccessControlHTTPStreaming.onHTTPSessionCreate[vod/definst:sample.mp4]: accept:true” in the console.

Richard

Roy,

I will have to test more later today. Are you able to establish a playback session that actually plays using a made-up wowzasessionid, or one from another session?

Richard

I have been testing and I don’t think this is an issue. Wowza ignores a made-up wowzasessionid, and onHTTPCreateSession runs as necessary, in applications with StreamType live, vod and liverepeater-edge in my tests

Richard

Roy,

I’ll test again. Did you get the wowzasessionid from another session? Or is it the string length?

Richard

Roy,

I tried again, I cannot replicate. If I add ?wowzasessionid=1682498420 to the playlist.m3u8 in the html page, onHTTPSessionCreate still runs in a livestream-edge application.

Richard

SK,

Can you detail what is going on in your case? onHTTPSessionCreate should fire for each cupertino, smooth or sanjose session. There is a complete example here:

https://www.wowza.com/docs/how-to-control-access-to-http-streams-cupertinostreaming-sanjosestreaming-smoothstreaming-mpegdashstreaming

Richard

What version of Wowza are you running? The problem Roy discovered was fixed in Wowza 3.5.1. You can update to Wowza 3.5.2 by applying the 3x-3.5.2 patch here:

https://www.wowza.com/docs/wowza-streaming-engine-software-updates

You can also apply the latest dev patch while you are at it to be current:

https://www.wowza.com/docs/wowza-streaming-engine-software-updates

Richard

hi,

any updates for this ? i am having the same problem.

This is annoying if you make a server module using onHTTPSessionCreate() to protect http stream which is bypassed with this trick

-SK

SK,

Can you detail what is going on in your case? onHTTPSessionCreate should fire for each cupertino, smooth or sanjose session. There is a complete example here:

Control access to HTTP streams with the Wowza Streamin

Richard

Richard,

it is the same context as explained in previous posts : in a liverepeater-edge situation, some clients access the cupertino stream using an URL in the following format :

http://mydomain.tld/app_name/_definst_/stream_name/playlist.m3u8?wowzasessionid=218840585&v=hghpl

With this URL, the onHTTPSessionCreate() is not triggered. Currently, i have no idea how they get the value of wowzasessionid (even if i shutdown and start the server, the direct URL work and does not trigger the event).

-SK

Richard,

i tested my module with Wowza 3.5.2 (using Linux OS) and probleme still here.

BUT, my module was compiled on a Wowza IDE using Wowza 3.0.3. I am gonna re-install IDE and Wowza 3.5.2 and compile module again and try again tests.

I will post my results when it is done.

-SK

Hi, Richard

Thanks for your testing.

In my test, if Application StreamType set to VOD or Live.

It works fine with and without wowzasessionid.

The problem only occurs if Application StreamType set liverepeater-edge.

The edge server version is “#Software: Wowza Media Server 3.1.2 build1624”

The origin server version is “#Software: Wowza Media Server 2.2.3.12 build27289”

Thanks,

Roy

Richard,

Thanks for your testing again.

My reproduce step is

  1. start up wowza

  2. connect live-repeater application with some specific wowzasessionid

  3. device playbacks video but server does not log onHTTPSessionCreate

In this case, is this wowzasessionid a made-up session?

Wowza server just start up and never allocate session.

The client just take wowzasessionid in query string, it makes itself a valid session and playback without any authentication.

Something strange is that some specific wowzasessionid can work, not any random number could cause this problem.

Thanks,

Roy

I found this problem because some invalid user play our stream for a while with those specific wowzasessionid.

I have no idea how they get these specific wowzasessionid.

And these wowzasessiond works on other wowza server(ex: my testing server) in my reproduce step.

Here are some example

wowzasessionid=1682498420

wowzasessionid=400685476

wowzasessionid=1770083500

wowzasessionid=149622051

Thanks,

Roy

Richard,

I have re-installed the last version wowza.(Wowza Media Server 3.5.0 build2989)

And use your sample code to build module and modify the config file to setup liverepeater-edge application.

The problem still exists.

I will send config and log files to support@wowza.com

Please help me to check what’s wrong with my setting.

Thanks,

Roy

Hi,

I am waiting for update information from wowza support team.

They found the first connection after wowza server start will cause this problem.

My short term solution is adding a server listener to check each HTTP session if it is valid periodically.

This is not the best solution, but it can reduce most impact of network bandwidth for me.

Roy

Hello Roy,

If you find the solution, can you share with us? I have the same problem with one of my clients…

Thanks!