原始HTTP - 在GET行中使用完整URL?

<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');

header('content-type: text/plain');

$host='www.google.com';

$fp = fsockopen($host, 80);

$out = "GET http://www.google.com/ HTTP/1.1
";
$out .= "Host: $host
";
$out .= "Connection: Close

";
fwrite($fp, $out);

while (!feof($fp)) {
    echo fgets($fp, 128);
}

?>

this just works.

is it standards compliant?

Yes it is.

From the specification:

Request-Line = Method SP Request-URI SP HTTP-Version CRLF

...and...

Request-URI = "*" | absoluteURI | abs_path | authority

Yes, according to 5.1.2 of RFC 2616:

An example Request-Line would be:

  GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1

To allow for transition to absoluteURIs in all requests in future versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI form in requests, even though HTTP/1.1 clients will only generate them in requests to proxies.