From 2bbef63647b0e50331557e8b59e22c3a2963bb26 Mon Sep 17 00:00:00 2001 From: Ranjan Shrestha Date: Thu, 2 Jan 2020 05:03:21 +0545 Subject: [PATCH] Huawei devices use underscore on host names (#95) RFC 952 allows only alpha numeric characters and dashes on host names. But Huawei android devices use underscore. This results in an error while communicating with those devices. --- UdpSocket.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UdpSocket.js b/UdpSocket.js index f21116a8..d5f8578a 100644 --- a/UdpSocket.js +++ b/UdpSocket.js @@ -23,8 +23,8 @@ var Sockets = NativeModules.UdpSockets var base64 = require('base64-js') var ipRegex = require('ip-regex') var normalizeBindOptions = require('./normalizeBindOptions') -// RFC 952 hostname format -var hostnameRegex = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/; +// RFC 952 hostname format, except for Huawei android devices that include '_' on their hostnames +var hostnameRegex = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9_\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9_\-]*[A-Za-z0-9])$/; var noop = function () {} var instances = 0 var STATE = {