m6w6 / ext-http

Extended HTTP Support
BSD 2-Clause "Simplified" License
79 stars 22 forks source link

fatal error when using punycode in URLs #42

Closed s-thet closed 8 years ago

s-thet commented 8 years ago

Trying to load http://www.köln.de punycode encoded results in warnings and fatal errors.

<?php
$url = 'http://www.xn--kln-sna.de';
$req = new \http\Client\Request('GET', $url);
$client = (new \http\Client())->enqueue($req)->send();
PHP Warning:  http\Client\Request::__construct(): Failed to parse host; unexpected '-' at pos 7 in 'www.xn--kln-sna.de'
PHP Fatal error:  Uncaught http\Exception\RuntimeException: http\Client::enqueue(): Cannot request empty URL
Stack trace:
#0 ...: http\Client->enqueue(Object(http\Client\Request))
#1 {main}
m6w6 commented 8 years ago

Thanks for your report!

m6w6 commented 8 years ago

In the meantime, if your build supports IDNA, you can use the NFC-UTF8 URL as-is.