Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento",
"author": "Tim Marshall <[email protected]>",
"description": "Magento SOAP API wrapper for Node.js",
"version": "0.0.5",
"version": "0.0.6",
"main": "./src/magento",
"contributors": [
{
Expand Down
20 changes: 19 additions & 1 deletion src/magento.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var resources = {
store: './resources/store.js'
};
var mandatory = {};
var isSecure = false;
var configDefaults = {
host: mandatory,
port: 80,
Expand Down Expand Up @@ -76,8 +77,25 @@ function Magento(config) {
}
}

// Handle secure authentication
// Port 443, or isSecure: true in the
// options should make secure requests
if (magentoConfig.isSecure !== undefined) {
isSecure = magentoConfig.isSecure;
delete magentoConfig.isSecure;
}
if (magentoConfig.port !== undefined) {
if (isSecure && magentoConfig.port == 80) {
magentoConfig.port == 443;
} else if (!isSecure && magentoConfig.port == 443) {
isSecure = true;
}
}

this.config = magentoConfig;
this.client = xmlrpc.createClient(this.config);
this.client = (isSecure)
? xmlrpc.createSecureClient(this.config)
: xmlrpc.createClient(this.config);
this.queue = [];
this.queue.running = 0;
this.queue.parallelLimit = this.config.parallelLimit;
Expand Down