Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusts WSDL URL detection to be case insensitive #1082

Merged
merged 1 commit into from
Jul 13, 2019
Merged
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
4 changes: 2 additions & 2 deletions src/wsdl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ export class WSDL {
}

let includePath: string;
if (!/^https?:/.test(this.uri) && !/^https?:/.test(include.location)) {
if (!/^https?:/i.test(this.uri) && !/^https?:/i.test(include.location)) {
includePath = path.resolve(path.dirname(this.uri), include.location);
} else {
includePath = url.resolve(this.uri || '', include.location);
Expand Down Expand Up @@ -1368,7 +1368,7 @@ export function open_wsdl(uri: any, p2: WSDLCallback | IOptions, p3?: WSDLCallba
const request_options = options.wsdl_options;

let wsdl: WSDL;
if (!/^https?:/.test(uri)) {
if (!/^https?:/i.test(uri)) {
debug('Reading file: %s', uri);
fs.readFile(uri, 'utf8', (err, definition) => {
if (err) {
Expand Down
12 changes: 12 additions & 0 deletions test/client-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ var fs = require('fs'),
});
});

it('should detect uppercase schemas as urls', function(done) {
soap.createClient('HTTP://localhost:1', function(err, client) {
assert.ok(err)
// ECONNREFUSED indicates that the WSDL path is being evaluated as a URL
// If instead ENOENT is returned, the WSDL path is being evaluated (incorrectly)
// as a file system path
assert.equal(err.code, 'ECONNREFUSED');

done();
});
});

it('should add and clear soap headers', function (done) {
soap.createClient(__dirname + '/wsdl/default_namespace.wsdl', meta.options, function (err, client) {
assert.ok(client);
Expand Down