--- tools/source/fsys/urlobj.cxx
+++ tools/source/fsys/urlobj.cxx
@@ -2365,7 +2365,7 @@ bool INetURLObject::parseHost(
 					aTheCanonic.append(sal_Unicode('['));
 					eState = STATE_IP6;
 				}
-				else if (INetMIME::isAlpha(*p))
+				else if (INetMIME::isAlpha(*p) || *p == '_')
 					eState = STATE_TOPLABEL;
 				else if (INetMIME::isDigit(*p))
 				{
@@ -2383,19 +2383,19 @@ bool INetURLObject::parseHost(
 					eState = STATE_LABEL_DOT;
 				else if (*p == '-')
 					eState = STATE_LABEL_HYPHEN;
-				else if (!INetMIME::isAlphanumeric(*p))
+				else if (!INetMIME::isAlphanumeric(*p) && *p != '_')
 					goto done;
 				break;
 
 			case STATE_LABEL_HYPHEN:
-				if (INetMIME::isAlphanumeric(*p))
+				if (INetMIME::isAlphanumeric(*p) || *p == '_')
 					eState = STATE_LABEL;
 				else if (*p != '-')
 					goto done;
 				break;
 
 			case STATE_LABEL_DOT:
-				if (INetMIME::isAlpha(*p))
+				if (INetMIME::isAlpha(*p) || *p == '_')
 					eState = STATE_TOPLABEL;
 				else if (INetMIME::isDigit(*p))
 					eState = STATE_LABEL;
@@ -2408,19 +2408,19 @@ bool INetURLObject::parseHost(
 					eState = STATE_TOPLABEL_DOT;
 				else if (*p == '-')
 					eState = STATE_TOPLABEL_HYPHEN;
-				else if (!INetMIME::isAlphanumeric(*p))
+				else if (!INetMIME::isAlphanumeric(*p) && *p != '_')
 					goto done;
 				break;
 
 			case STATE_TOPLABEL_HYPHEN:
-				if (INetMIME::isAlphanumeric(*p))
+				if (INetMIME::isAlphanumeric(*p) || *p == '_')
 					eState = STATE_TOPLABEL;
 				else if (*p != '-')
 					goto done;
 				break;
 
 			case STATE_TOPLABEL_DOT:
-				if (INetMIME::isAlpha(*p))
+				if (INetMIME::isAlpha(*p) || *p == '_')
 					eState = STATE_TOPLABEL;
 				else if (INetMIME::isDigit(*p))
 					eState = STATE_LABEL;
@@ -2442,7 +2442,7 @@ bool INetURLObject::parseHost(
 						eState = STATE_LABEL_DOT;
 				else if (*p == '-')
 					eState = STATE_LABEL_HYPHEN;
-				else if (INetMIME::isAlpha(*p))
+				else if (INetMIME::isAlpha(*p) || *p == '_')
 					eState = STATE_LABEL;
 				else if (INetMIME::isDigit(*p))
 					if (nDigits < 3)
@@ -2457,7 +2457,7 @@ bool INetURLObject::parseHost(
 				break;
 
 			case STATE_IP4_DOT:
-				if (INetMIME::isAlpha(*p))
+				if (INetMIME::isAlpha(*p) || *p == '_')
 					eState = STATE_TOPLABEL;
 				else if (INetMIME::isDigit(*p))
 				{
@@ -5311,7 +5311,7 @@
 		switch (eState)
 		{
 			case STATE_DOT:
-				if (p != pEnd && INetMIME::isAlphanumeric(*p))
+				if (p != pEnd && (INetMIME::isAlphanumeric(*p) || *p == '_'))
 				{
 					++nLabels;
 					eState = STATE_LABEL;
@@ -5324,7 +5324,7 @@
 
 			case STATE_LABEL:
 				if (p != pEnd)
-					if (INetMIME::isAlphanumeric(*p))
+					if (INetMIME::isAlphanumeric(*p) || *p == '_')
 						break;
 					else if (*p == '.')
 					{
@@ -5342,7 +5342,7 @@
 
 			case STATE_HYPHEN:
 				if (p != pEnd)
-					if (INetMIME::isAlphanumeric(*p))
+					if (INetMIME::isAlphanumeric(*p) || *p == '_')
 					{
 						eState = STATE_LABEL;
 						break;
