Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #35 from hashworks/bugfix/rizonIPv6Hostname
Browse files Browse the repository at this point in the history
Allow : and / in hostnames so we can properly handle some weird hostnames
  • Loading branch information
elazar committed Jun 10, 2015
2 parents 6d64815 + 3eb687c commit 1a409e9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function __construct()
// ? provides for relaxed parsing of messages without trailing parameters properly demarcated
$trailing = "(?: :?[^$null$crlf]*)";
$params = "(?P<params>$trailing?|(?:$middle{0,14}$trailing))";
$name = "[$letter$number](?:[$letter$number\\-]*[$letter$number])?";
$name = "[$letter$number](?:[$letter$number:\/\\-]*[$letter$number])?";
$host = "$name(?:\\.(?:$name)*)*";
$nick = "(?:[$letter$special][$letter$number$special-]*)";
$user = "(?:[^ $null$crlf@]+)";
Expand Down
50 changes: 50 additions & 0 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,56 @@ public function dataProviderTestParse()
),
),

// Some servers use weird cloaked hostnames, although it's not RFC conform
array(
":WiZ!jto@DCE7E23D:1D6D03E4:2248D1C4:IP PART #playzone :I lost\r\n",
array(
'prefix' => ':WiZ!jto@DCE7E23D:1D6D03E4:2248D1C4:IP',
'nick' => 'WiZ',
'user' => 'jto',
'host' => 'DCE7E23D:1D6D03E4:2248D1C4:IP',
'command' => 'PART',
'params' => array(
'channels' => '#playzone',
'message' => 'I lost',
'all' => '#playzone :I lost',
),
'targets' => array('#playzone'),
),
),
array(
":WiZ!jto@facebook/hhvm/sgolemon PART #playzone :I lost\r\n",
array(
'prefix' => ':WiZ!jto@facebook/hhvm/sgolemon',
'nick' => 'WiZ',
'user' => 'jto',
'host' => 'facebook/hhvm/sgolemon',
'command' => 'PART',
'params' => array(
'channels' => '#playzone',
'message' => 'I lost',
'all' => '#playzone :I lost',
),
'targets' => array('#playzone'),
),
),
array(
":WiZ!jto@gateway/web/irccloud.com/x-yjyvvvvrtuiwaqco PART #playzone :I lost\r\n",
array(
'prefix' => ':WiZ!jto@gateway/web/irccloud.com/x-yjyvvvvrtuiwaqco',
'nick' => 'WiZ',
'user' => 'jto',
'host' => 'gateway/web/irccloud.com/x-yjyvvvvrtuiwaqco',
'command' => 'PART',
'params' => array(
'channels' => '#playzone',
'message' => 'I lost',
'all' => '#playzone :I lost',
),
'targets' => array('#playzone'),
),
),

// MODE (RFC 1459 Section 4.2.3)
array(
"MODE #Finnish :+im\r\n",
Expand Down

0 comments on commit 1a409e9

Please sign in to comment.