Skip to content

Commit 267ca2d

Browse files
committed
Fix uri parse.
1 parent 1057527 commit 267ca2d

File tree

5 files changed

+305
-244
lines changed

5 files changed

+305
-244
lines changed

lib/src/grammar.peg

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ password <- ( unreserved / escaped / "&" / "=" / "+" / "$" / "," )* {
420420

421421
hostport <- host ( ":" port )?
422422

423-
host <- ( hostname / IPv4address / IPv6reference ) {
423+
host <- ( hostname / IPv4address / IPv6reference / hosttoken) {
424424
$$ = $1; }
425425

426426
## 'hostname' grammar is relaxed from RFC 3261:
@@ -434,6 +434,15 @@ hostname <- (( domainlabel "." )* toplabel "." ?) {
434434
result['host'] = data.host;
435435
$$ = result; }
436436

437+
## hello <sip:asterisk@8c2d06b92042:5060;transport=ws>
438+
hosttoken <- token_nodot {
439+
data.host = _text();
440+
data.host_type = 'domain';
441+
var result = {};
442+
result['host_type'] = data.host_type;
443+
result['host'] = data.host;
444+
$$ = result; }
445+
437446
domainlabel <- alphanum ( alphanum / "-" / "_" )*
438447

439448
toplabel <- ALPHA ( alphanum / "-" / "_" )*

0 commit comments

Comments
 (0)