Pārlūkot izejas kodu

Only accept width/height params if the STREAM_SECRET matches

phoboslab 11 gadus atpakaļ
vecāks
revīzija
f59de44b72
1 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 3 2
      stream-server.js

+ 3 - 2
stream-server.js Parādīt failu

48
 // HTTP Server to accept incomming MPEG Stream
48
 // HTTP Server to accept incomming MPEG Stream
49
 var streamServer = require('http').createServer( function(request, response) {
49
 var streamServer = require('http').createServer( function(request, response) {
50
 	var params = request.url.substr(1).split('/');
50
 	var params = request.url.substr(1).split('/');
51
-	width = (params[1] || 320)|0;
52
-	height = (params[2] || 240)|0;
53
 
51
 
54
 	if( params[0] == STREAM_SECRET ) {
52
 	if( params[0] == STREAM_SECRET ) {
53
+		width = (params[1] || 320)|0;
54
+		height = (params[2] || 240)|0;
55
+		
55
 		console.log(
56
 		console.log(
56
 			'Stream Connected: ' + request.socket.remoteAddress + 
57
 			'Stream Connected: ' + request.socket.remoteAddress + 
57
 			':' + request.socket.remotePort + ' size: ' + width + 'x' + height
58
 			':' + request.socket.remotePort + ' size: ' + width + 'x' + height