Ignore requests to other hosts.
This commit is contained in:
parent
fe96a9de33
commit
b6c2e7ef76
1 changed files with 3 additions and 1 deletions
|
@ -8,7 +8,7 @@ hostPathMap = {}
|
||||||
hostPathMapNextKey = 0
|
hostPathMapNextKey = 0
|
||||||
|
|
||||||
getHostForPath = (path) ->
|
getHostForPath = (path) ->
|
||||||
key = "extension-#{hostPathMapNextKey}"
|
key = "extension-#{++hostPathMapNextKey}"
|
||||||
hostPathMap[key] = path
|
hostPathMap[key] = path
|
||||||
key
|
key
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ app.once 'ready', ->
|
||||||
parsed = url.parse request.url
|
parsed = url.parse request.url
|
||||||
return unless parsed.hostname and parsed.path?
|
return unless parsed.hostname and parsed.path?
|
||||||
|
|
||||||
|
return unless /extension-\d+/.test parsed.hostname
|
||||||
|
|
||||||
directory = getPathForHost parsed.hostname
|
directory = getPathForHost parsed.hostname
|
||||||
return new protocol.RequestFileJob(path.join(directory, parsed.path))
|
return new protocol.RequestFileJob(path.join(directory, parsed.path))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue