Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[CB-1494] weinre - Supports running server behind a proxy, such as He…
…roku 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.
  • Loading branch information
pmuellr committed Nov 30, 2012
1 parent de980f8 commit 19454cfe2cd3c4515f7fb615f35fa2c7b2565401
Showing 2 changed files with 16 additions and 15 deletions.
@@ -52,6 +52,7 @@ <h2>2012/??/?? - version 2.0.0</h2>
<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>

<!-- ======================================================================= -->
@@ -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?

0 comments on commit 19454cf

Please sign in to comment.