Skip to content

Commit fb508f9

Browse files
committed
Give a proper error when an unsupported protocol is used for connection in Thin mode
1 parent bcc04fe commit fb508f9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/thin/sqlnet/ezConnectResolver.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ Test Case in oracle_private/ezconnectTest.js
3939
const HOSTNAMES_PATTERN = new RegExp("((?=(?<hostnames>(((\\[[A-z0-9:]+\\])|([A-z0-9][A-z0-9._-]+))[,]?)+)))\\k<hostnames>(:(?<port>\\d+)?)?", 'g');
4040

4141
// The EZConnect pattern without the extended settings part.
42-
const EZ_URL_PATTERN = new RegExp("^((?<protocol>tcp|tcps):)?"
43-
+ "(//)?"
42+
const EZ_URL_PATTERN = new RegExp("^(((?<protocol>[A-z0-9]+):)?//)?"
4443
+ "(?<hostinfo>(" + HOSTNAMES_PATTERN.source + "(?=([,]|[;]|[/]|[:]|$))([,]|[;])?)+)"
4544
+ "(/(?<servicename>[A-z0-9][A-z0-9,-.]+)?)"
4645
+ "?(:(?<servermode>dedicated|shared|pooled))"
@@ -145,6 +144,8 @@ class EZConnectResolver {
145144
if (protocol == null) {
146145
if (!(url.includes("//")))
147146
protocol = 'TCP';
147+
} else if (protocol.toLowerCase() != 'tcp' && protocol.toLowerCase() != 'tcps') {
148+
errors.throwErr(errors.ERR_INVALID_EZCONNECT_SYNTAX, 'Invalid protocol', protocol);
148149
}
149150
// Try to get the proxy information from URL properties
150151
const proxyHost = this.urlProps.get("HTTPS_PROXY");

0 commit comments

Comments
 (0)