Skip to content

Commit

Permalink
add proxy settings
Browse files Browse the repository at this point in the history
  • Loading branch information
pofider committed Feb 11, 2016
1 parent 0636aec commit 1c6f3e8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ var conversion = require("phantom-html-to-pdf")({
strategy: "phantom-server | dedicated-process",
/* optional path to the phantomjs binary
NOTE: When using phantomjs 2.0, be aware of https://github.com/ariya/phantomjs/issues/12685 */
phantomPath: "{path to phantomjs}"
phantomPath: "{path to phantomjs}",
/* see phantomjs arguments for proxy setting details */
proxy,proxy-type,proxy-auth
});
```

Expand Down
19 changes: 16 additions & 3 deletions lib/dedicatedProcessStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,24 @@ module.exports = function(options, requestOptions, id, cb) {
var childArgs = [
'--ignore-ssl-errors=yes',
'--web-security=false',
'--ssl-protocol=any',
path.join(__dirname, 'scripts', 'standaloneScript.js'),
settingsFilePath
'--ssl-protocol=any'
];

if (options.proxy) {
childArgs.push('--proxy=' + options.proxy);
}

if (options['proxy-type']) {
childArgs.push('--proxy-type=' + options['proxy-type']);
}

if (options['proxy-auth']) {
childArgs.push('--proxy-auth=' + options['proxy-auth']);
}

childArgs.push(path.join(__dirname, 'scripts', 'standaloneScript.js'));
childArgs.push(settingsFilePath);

var isDone = false;

var data = "";
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"lodash": "4.2.1",
"phantom-workers": "0.3.2",
"phantom-workers": "0.3.3",
"uuid": "2.0.1"
},
"optionalDependencies": {
Expand All @@ -32,7 +32,7 @@
"should": "5.0.1"
},
"scripts": {
"test": "node lib/prepareScripts.js && mocha test/test.js --timeout 4000",
"test": "node lib/prepareScripts.js && mocha test/test.js --timeout 8000",
"postinstall": "node lib/prepareScripts.js"
},
"main": "index.js",
Expand Down

0 comments on commit 1c6f3e8

Please sign in to comment.