function flickr_curl_set_port in Flickr 7
Set port options.
Parameters
array $options [reference]: Options array
object $ch [reference]: cURL Object
array $uri [reference]: URI array
Return value
bool Returns TRUE if they were set properly, FALSE otherwise.
1 call to flickr_curl_set_port()
- flickr_curl_http_request in ./
flickr.inc - Performs an HTTP request over cURL. Taken from http://cgit.drupalcode.org/chr/tree/chr.module.
File
- ./
flickr.inc, line 2187 - The Flickr API functions.
Code
function flickr_curl_set_port(&$options, &$ch, &$uri) {
$default_ports = array(
'http' => 80,
'feed' => 80,
'https' => 443,
);
if (array_key_exists($uri['scheme'], $default_ports)) {
if (!isset($uri['port'])) {
$uri['port'] = $default_ports[$uri['scheme']];
}
// RFC 2616: "non-standard ports MUST, default ports MAY be included".
// We don't add the standard port to prevent from breaking rewrite rules
// checking the host that do not take into account the port number.
$options['headers']['Host'] = $uri['host'] . ($uri['port'] != 80 ? ':' . $uri['port'] : '');
return TRUE;
}
else {
return FALSE;
}
}