PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Networking » Net_URL » Bug #7649

Net_URL doens't complain about invalid URLs

Details

Submitted2006-05-17 12:33 UTC
Frommfischer at php dot net
Assigneddavidc
StatusBogus
PackageNet_URL
PHP VersionIrrelevant
OSAny
Roadmaps1.0.15

Comments

[2006-05-17 12:33 UTC] mfischer at php dot net

Description:
------------
Net_URL accepts invalid URLs like "http://www.netcraft.com/ not allowed". This is evident when you e.g. try to use HTTP_Request to fetch a URL.

Internally, HTTP_Request is passing the URL to Net_URL and Net_URL happily accepts the invalid URL.

Common sense of user agents is that they convert the space, which violates the specs, to e.g. + or %20. This is verified with wget, lynx, FF, IE, Opera.

Because of this the server response differently and very likely not as expected.

It seems related to http://pear.php.net/bugs/bug.php?id=2991

Test script:
---------------
require_once "HTTP/Request.php";
$req = new HTTP_Request("http://www.netcraft.com/ not found");
$req->sendRequest();
var_dump($req->getResponseCode());

Expected result:
----------------
int(404)

Actual result:
--------------
int(400)