From e3514ee1dc5b2857e6bf6c907b1d05421d1f8237 Mon Sep 17 00:00:00 2001 From: Jon Kristensen Date: Sun, 24 Jul 2011 13:22:28 +0200 Subject: [PATCH] stopped using idna2008 as clients don't have to support internationalization --- Network/XMPP/Address.hs | 14 +++++++------- pontarius-xmpp.cabal | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Network/XMPP/Address.hs b/Network/XMPP/Address.hs index 6fd1066..fafd812 100644 --- a/Network/XMPP/Address.hs +++ b/Network/XMPP/Address.hs @@ -3,8 +3,6 @@ {-# OPTIONS_HADDOCK hide #-} --- TODO: Move away from stringprep for all three profiles. - -- TODO: When no longer using stringprep, do appropriate testing. (Including -- testing addresses like a@b/c@d/e, a/b@c, a@/b, a/@b...) @@ -14,8 +12,7 @@ -- This module deals with XMPP addresses (also known as JIDs and JabberIDs). For -- more information on XMPP addresses, see RFC 6122: XMPP: Address Format. -- --- Provided hostnames may contain international characters; Pontarius XMPP will --- try to convert such hostnames to internationalized hostnames. +-- This module does not internationalize hostnames. module Network.XMPP.Address (fromString, fromStrings, isBare, isFull) where @@ -30,8 +27,6 @@ import Text.StringPrep (StringPrepProfile (..), a1, b1, b2, c11, c12, c21, c22, c3, c4, c5, c6, c7, c8, c9, runStringPrep) import Text.NamePrep (namePrepProfile) -import Data.Text.IDNA2008 (toASCII) - import Network.URI (isIPv4address, isIPv6address) import qualified Data.ByteString.Char8 as DBC (pack) @@ -92,7 +87,8 @@ fromStrings l s r -- function was successful, or Nothing otherwise. domainpart' :: Maybe String domainpart' | isIPv4address s || isIPv6address s = Just s - | otherwise = toASCII s + | validHostname s = Just s + | otherwise = Nothing -- Validates that non-domainpart strings have an appropriate length. validateNonDomainpart :: Maybe String -> Bool @@ -102,6 +98,10 @@ fromStrings l s r validPartLength :: String -> Bool validPartLength p = length p > 0 && length p < 1024 + -- Validates a host name + validHostname :: String -> Bool + validHostname _ = True -- TODO + -- | Returns True if the address is `bare', and False otherwise. diff --git a/pontarius-xmpp.cabal b/pontarius-xmpp.cabal index ff0cbc2..440e3ef 100644 --- a/pontarius-xmpp.cabal +++ b/pontarius-xmpp.cabal @@ -31,7 +31,7 @@ Library base64-string, pureMD5, utf8-string, network, xml-types, text, transformers, bytestring, cereal ==0.3.3.0, random, xml-enumerator, tls, tls-extra, containers, mtl, text-icu, - stringprep, idna2008 ==0.0.1.0, asn1-data, cryptohash ==0.7.0, + stringprep, asn1-data, cryptohash ==0.7.0, time, certificate, ranges, uuid -- Other-Modules: -- HS-Source-Dirs: