Sunday, December 4, 2011

Typo on HttpSocket class?

I've been having issues when making HTTPS requests to servers via HttpSocket. HTTP requests work just fine. Checking the code of that class, I noticed the following piece starting on line 272. I'm on the latest 2.04 stable version, btw.

if (is_array($this->request['header'])) {
if (!empty($this->request['cookies'])) {
$cookies = $this->buildCookies($this->request['cookies']);
}
$schema = '';
$port = 0;
if (isset($this->request['uri']['schema'])) {
$schema = $this->request['uri']['schema'];
}
if (isset($this->request['uri']['port'])) {
$port = $this->request['uri']['port'];
}
if (
($schema === 'http' && $port != 80) ||
($schema === 'https' && $port != 443) ||
($port != 80 && $port != 443)
) {
$Host .= ':' . $port;
}
$this->request['header'] = array_merge(compact('Host'), $this->request['header']);
}

As far as I know, the request array never has a schema key, although it does have a scheme key, as seen here. It's interesting that it seems that the code has been like since version 1.0 and I couldn't find anything about it on the web. I also changed the letter, just to see if my code worked, but it caused warnings and notices. So... am I missing something?

I wanted to run it by this group first, before I started digging deeper into the code. Any help or clarification will be appreciated.

Thanks.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: