.
D 2012-05-31T22:28:35
J assignee patthoyts
J cmimetype text/plain
J comment The\scurrent\simplementation\sof\sthe\shttp\slibrary\sdoes\snot\ssupport\sURLs\sthat\scontain\sraw\sIPv6\sspecifications,\si.e.\shttp://[2001:5c0:1400:b::d623]/\sto\stake\smine\sas\san\sexample.\sThe\sproblem\sis\sthat\sthe\satom\sof\sthe\sregexp\sthat\sshould\smatch\sthe\shost\spart\sof\sthe\sauthority\sis\swritten\sas\s[^/:\\#?]+\swhich\swill\snot\swork\ssince\sIPv6\saddresses\sare\swritten\susing\s:\sas\sseparators\s(well,\snot\s*entirely*\strue,\sbut\salmost).\sTherefore,\sthe\sparsing\sstops\sat\simproper\splaces\swithin\sthe\sURL\sspecification\sand\sends\sup\snot\sbeing\sable\sto\sopen\sthe\ssocket\sagainst\sthe\sIP\saddress,\seven\sthough\sTcl\s8.6\snow\shas\ssupport\sfor\sIPv6.\n\nThe\sfollowing\scode\s(extract\sout\sof\sthe\s"parsing"\spart\sof\sthe\sgeturl\sprocedure\sactually\sperforms\sthe\swork\sproperly:\n\n\s\s\sset\sURLmatcher\s{(?x)\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\sthis\sis\s_expanded_\ssyntax\s\n\s\s\s\s\s\s\s\s^\s\n\s\s\s\s\s\s\s\s(?:\s(\\w+)\s:\s)\s?\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\s<protocol\sscheme>\s\n\s\s\s\s\s\s\s\s(?:\s//\s\n\s\s\s\s\s\s\s\s\s\s\s\s(\s[^/\\#?]+\s)\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\s<location=userinfo\s+\shost\s+\sport>\s\n\s\s\s\s\s\s\s\s)?\s\n\s\s\s\s\s\s\s\s(\s/\s[^\\#]*)?\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\s<path>\s(including\squery)\s\n\s\s\s\s\s\s\s\s(?:\s\\#\s(.*)\s)?\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#\s<fragment>\s\n\s\s\s\s\s\s\s\s$\s\n\s\s\s\s}\s\n\n\s\s\s\s#\sPhase\sone:\sparse,\sthe\sURL\smatch\s\n\s\s\s\sif\s{![regexp\s--\s$URLmatcher\s$url\s->\sproto\slocation\ssrvurl]}\s{\s\n\s\s\s\s\s\s\s\sunset\s$token\s\n\s\s\s\s\s\s\s\sreturn\s-code\serror\s"Unsupported\sURL:\s$url"\s\n\s\s\s\s}\s\n\s\s\s\sif\s{\s[string\sfirst\s"@"\s$location]\s>=\s0\s}\s{\s\n\s\s\s\s\s\s\s\sforeach\s{user\shostport}\s[split\s$location\s"@"]\sbreak\s\n\s\s\s\s}\selse\s{\s\n\s\s\s\s\s\s\s\sset\suser\s""\s\n\s\s\s\s\s\s\s\sset\shostport\s$location\s\n\s\s\s\s}\s\n\s\s\s\sset\sidx\s[string\slast\s":"\s$hostport]\s\n\s\s\s\sif\s{\s$idx\s>=\s0\s}\s{\s\n\s\s\s\s\s\s\s\sset\sport\s[string\strimleft\s[string\srange\s$hostport\s$idx\send]\s":"]\s\n\s\s\s\s\s\s\s\sif\s{\s[string\sis\sinteger\s$port]\s}\s{\s\n\s\s\s\s\s\s\s\s\s\s\s\sset\shost\s[string\strimright\s[string\srange\s$hostport\s0\s$idx]\s":"]\s\n\s\s\s\s\s\s\s\s}\selse\s{\s\n\s\s\s\s\s\s\s\s\s\s\s\sset\sport\s""\s\n\s\s\s\s\s\s\s\s\s\s\s\sset\shost\s$hostport\s\n\s\s\s\s\s\s\s\s}\s\n\s\s\s\s}\selse\s{\s\n\s\s\s\s\s\s\s\sset\sport\s""\s\n\s\s\s\s\s\s\s\sset\shost\s$hostport\s\n\s\s\s\s}\s\n\s\s\s\sset\shost\s[string\strim\s$host\s"\\[\\]"]\s\n\n\s\s\s\s#\sPhase\stwo:\svalidate\s\n\nThis\sversion\sminimises\sthe\sregexp\sparsing\sand\sadds\sa\snumber\sof\sstring\soperations.\sIt's\snot\sperfect,\sbut\sat\sleast\ssolve\sthe\sissue.\sA\sregexp\sguru\swould\sbe\sneeded\sto\sfix\sthis\sat\sthe\sregexp\slevel.
J foundin None
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter efrecon
J subsystem 29.\shttp\sPackage
J title Improper\ssupport\sfor\sIPv6\sraw\saddress\sin\shttp\slibrary
J type Bug
K 3531209fffffffffffffffffffffffffffffffff
U efrecon
Z b0e45dc04e43b597d721afb3400a90ac