You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pm...@apache.org on 2012/11/30 19:42:14 UTC
weinre commit: [CB-1494] weinre - Supports running server behind a
proxy, such as Heroku Cedar
Updated Branches:
refs/heads/master de980f8b0 -> 19454cfe2
[CB-1494] weinre - Supports running server behind a proxy, such as Heroku Cedar
https://issues.apache.org/jira/browse/CB-1494
Easiest thing to do is just neuter the remote address check in
the getChannel() function in the weinre.server/lib/channelManager.coffee
source file.
All this provided before was a simplistic check to make sure the
requests always were coming from the same remote address; for
someone who wanted to cheat, there were ways of cheating, and so
still are. For everyone else, you can now run under proxy servers
transparently.
Project: http://git-wip-us.apache.org/repos/asf/cordova-weinre/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-weinre/commit/19454cfe
Tree: http://git-wip-us.apache.org/repos/asf/cordova-weinre/tree/19454cfe
Diff: http://git-wip-us.apache.org/repos/asf/cordova-weinre/diff/19454cfe
Branch: refs/heads/master
Commit: 19454cfe2cd3c4515f7fb615f35fa2c7b2565401
Parents: de980f8
Author: Patrick Mueller <pm...@apache.org>
Authored: Fri Nov 30 13:38:02 2012 -0500
Committer: Patrick Mueller <pm...@apache.org>
Committed: Fri Nov 30 13:38:02 2012 -0500
----------------------------------------------------------------------
weinre.doc/ChangeLog.body.html | 1 +
weinre.server/lib/channelManager.coffee | 30 +++++++++++++-------------
2 files changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/19454cfe/weinre.doc/ChangeLog.body.html
----------------------------------------------------------------------
diff --git a/weinre.doc/ChangeLog.body.html b/weinre.doc/ChangeLog.body.html
index 2c0a98c..3bbbcf0 100644
--- a/weinre.doc/ChangeLog.body.html
+++ b/weinre.doc/ChangeLog.body.html
@@ -52,6 +52,7 @@
<li><a href="https://issues.apache.org/jira/browse/CB-1759">CB-1759</a> - doc indicates that you should launch weinre with a command prefix of `node`
<li><a href="https://issues.apache.org/jira/browse/CB-1193">CB-1193</a> - add Windows Phone support
<li><a href="https://issues.apache.org/jira/browse/CB-1800">CB-1800</a> - remove references to "incubator"
+<li><a href="https://issues.apache.org/jira/browse/CB-1494">CB-1494</a> - Supports running server behind a proxy, such as Heroku Cedar
</ul>
<!-- ======================================================================= -->
http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/19454cfe/weinre.server/lib/channelManager.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/channelManager.coffee b/weinre.server/lib/channelManager.coffee
index 48abca6..d55bb01 100644
--- a/weinre.server/lib/channelManager.coffee
+++ b/weinre.server/lib/channelManager.coffee
@@ -39,7 +39,7 @@ utils.registerClass class ChannelManager
WeinreClientEvents = serviceManager.get 'WeinreClientEvents'
WeinreTargetEvents = serviceManager.get 'WeinreTargetEvents'
-
+
if !WeinreClientEvents
utils.exit 'WeinreClientEvents service not registered'
@@ -49,7 +49,7 @@ utils.registerClass class ChannelManager
#---------------------------------------------------------------------------
created: (channel) ->
@channels[channel.name] = channel
-
+
#---------------------------------------------------------------------------
destroyed: (channel) ->
if channel.isClient
@@ -58,44 +58,44 @@ utils.registerClass class ChannelManager
else
for connection in channel.connections
@disconnectChannels(connection, channel)
-
+
clients = @getClientChannels(channel.id)
- if channel.isClient
+ if channel.isClient
WeinreClientEvents.clientUnregistered(clients, channel.name)
else
WeinreClientEvents.targetUnregistered(clients, channel.name)
- delete @channels[channel.name]
+ delete @channels[channel.name]
#---------------------------------------------------------------------------
getChannel: (name, remoteAddress) ->
return null if !_.has(@channels, name)
-
+
channel = @channels[name]
return null if !channel
-
- if remoteAddress
- return null if channel.remoteAddress != remoteAddress
-
+
+# if remoteAddress
+# return null if channel.remoteAddress != remoteAddress
+
channel
#---------------------------------------------------------------------------
connectChannels: (client, target) ->
return if client.isClosed or target.isClosed
-
+
if client.connections.length
@disconnectChannels(client, client.connections[0])
-
+
client.connections.push target
target.connections.push client
-
+
clients = @getClientChannels(client.id)
WeinreClientEvents.connectionCreated(clients, client.name, target.name)
WeinreTargetEvents.connectionCreated(target, client.name, target.name)
-
+
#---------------------------------------------------------------------------
disconnectChannels: (client, target) ->
@@ -106,7 +106,7 @@ utils.registerClass class ChannelManager
client.connections = _.without(client.connections, target)
target.connections = _.without(target.connections, client)
-
+
#---------------------------------------------------------------------------
getChannels: (id) ->
if id?