Example #1
0
 public function do_feed(h\string $meat)
 {
     if ($meat->length() < 1) {
         return null;
     }
     if (h\string(':')->is_equal($meat[0])) {
         $meat->behead(1);
     } else {
         return null;
     }
     for ($end_port = 0; \is_numeric((string) $meat[$end_port]); ++$end_port) {
         /* */
     }
     $port = $meat->behead($end_port);
     $port = $port->as_integer();
     if (1 > $port || $port > 65535) {
         throw $this->_exception_format('Specified port \'%d\' is incorrect', $port);
     }
     return $port;
 }
Example #2
0
 private function create_named_host_from_string(h\string $literal)
 {
     $end = $literal->search(':');
     if (-1 === $end) {
         $end = $literal->search('/');
     }
     if (-1 === $end) {
         $end = $literal->length();
     }
     $hostname = $literal->behead($end);
     $impl = new h\inet\host();
     $impl->segments = $hostname->explode('.');
     return $impl;
 }
Example #3
0
 public function do_create_net_path(h\string $meat)
 {
     $impl = new net_path();
     $slashes = $meat->behead(2);
     if (!h\string('//')->is_equal($slashes)) {
         throw $this->_exception('Not a net path');
     }
     $impl->authority->assign($this->master->factories['authority']->do_feed($meat));
     if (0 === $meat->search(h\string('/'))) {
         $impl->path = $this->do_feed($meat);
     } else {
         $impl->path->set_impl(new empty_path());
     }
     return $impl;
 }