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

Commit

Permalink
Allow / in hostnames, add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hashworks committed Jun 10, 2015
1 parent 9221d5f commit 3eb687c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
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
34 changes: 33 additions & 1 deletion tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public function dataProviderTestParse()
),
),

// Rizon uses IPv6 addresses in disguise, although it's not RFC conform
// 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(
Expand All @@ -463,6 +463,38 @@ public function dataProviderTestParse()
'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(
Expand Down

0 comments on commit 3eb687c

Please sign in to comment.