Merge pull request #3129 from sebv/http-callback

configurable callback address and port
This commit is contained in:
seb vincent
2014-07-14 01:38:45 -07:00
4 changed files with 20 additions and 1 deletions

View File

@@ -19,6 +19,8 @@ All flags are optional, but some are required in conjunction with certain others
|`-U`, `--udid`|null|Unique device identifier of the connected physical device|`--udid 1adsf-sdfas-asdf-123sdf`|
|`-a`, `--address`|0.0.0.0|IP Address to listen on|`--address 0.0.0.0`|
|`-p`, `--port`|4723|port to listen on|`--port 4723`|
|`-ca`, `--callback-address`|(same as --address)|IP Address to use to for http callback|`--callback-address 127.0.0.1`|
|`-cp`, `--callback-port`|(same as --port)|port to use to for http callback|`--port 4723`|
|`-bp`, `--bootstrap-port`|4724|(Android-only) port to use on device to talk to Appium|`--bootstrap-port 4724`|
|`-r`, `--backend-retries`|3|(iOS-only) How many times to retry launching Instruments before saying it crashed or timed out|`--backend-retries 3`|
|`--session-override`|false|Enables session override (clobbering)||

View File

@@ -38,6 +38,8 @@ var Appium = function (args) {
this.defCommandTimeoutMs = this.args.defaultCommandTimeout * 1000;
this.commandTimeoutMs = this.defCommandTimeoutMs;
this.commandTimeout = null;
this.args.callbackAddress = this.args.callbackAddress || this.args.address;
this.args.callbackPort = this.args.callbackPort || this.args.port;
};
Appium.prototype.attachTo = function (rest) {

View File

@@ -840,7 +840,7 @@ exports.executeAsync = function (req, res) {
, args = req.body.args
, responseUrl = '';
responseUrl += 'http://' + req.appium.args.address + ':' + req.appium.args.port;
responseUrl += 'http://' + req.appium.args.callbackAddress + ':' + req.appium.args.callbackPort;
responseUrl += '/wd/hub/session/' + req.appium.sessionId + '/receive_async_response';
if (checkMissingParams(req, res, {script: script, args: args})) {

View File

@@ -64,6 +64,21 @@ var args = [
, help: 'port to listen on'
}],
[['-ca', '--callback-address'], {
required: false
, dest: 'callbackAddress'
, example: "127.0.0.1"
, help: 'callback IP Address (default: same as address)'
}],
[['-cp', '--callback-port'], {
required: false
, dest: 'callbackPort'
, type: 'int'
, example: "4723"
, help: 'callback port (default: same as port)'
}],
[['-bp', '--bootstrap-port'], {
defaultValue: 4724
, dest: 'bootstrapPort'