note 101331 added to function.parse-url

From: Date: Fri, 10 Dec 2010 10:55:44 +0000
Subject: note 101331 added to function.parse-url
Groups: php.notes 
Request: Send a blank email to php-notes+get-174768@lists.php.net to get a copy of this message
It seems the host-part strips off the last [:port] off the end of the hostname When something is wrong in the actual request, this proves to be the wrong way to do things. It would be better to not strip off the [:port], but to keep the string *before* the first [:port] as the hostname. Problem with (maybe malformed) provided HTTP_HOST hostname:443:443 that resolved in 'host' => 'hostname:443' Which gave me problems. Solution would be to enforce this yourself, explicitly: $p = parse_url( $url ); $host = explode(':', $p['host']); $hostname = $host[0]; ---- Server IP: 213.249.64.162 Probable Submitter: 86.81.21.110 ---- Manual Page -- http://www.php.net/manual/en/function.parse-url.php Edit -- https://master.php.net/note/edit/101331 Del: integrated -- https://master.php.net/note/delete/101331/integrated Del: useless -- https://master.php.net/note/delete/101331/useless Del: bad code -- https://master.php.net/note/delete/101331/bad+code Del: spam -- https://master.php.net/note/delete/101331/spam Del: non-english -- https://master.php.net/note/delete/101331/non-english Del: in docs -- https://master.php.net/note/delete/101331/in+docs Del: other reasons-- https://master.php.net/note/delete/101331 Reject -- https://master.php.net/note/reject/101331 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174768) next »