[Solar-svn] Revision 3225
pmjones at solarphp.com
pmjones at solarphp.com
Sun Jun 15 08:05:45 CDT 2008
Solar_Http_Request_Adaper_Curl: [CHG] Slightly more efficient header processing.
Modified: trunk/Solar/Http/Request/Adapter/Curl.php
===================================================================
--- trunk/Solar/Http/Request/Adapter/Curl.php 2008-06-15 13:02:27 UTC (rev 3224)
+++ trunk/Solar/Http/Request/Adapter/Curl.php 2008-06-15 13:05:45 UTC (rev 3225)
@@ -130,29 +130,29 @@
}
// set specialized headers and retain all others
- $http_header = array();
- foreach ($headers as $header) {
+ foreach ($headers as $i => $header) {
$pos = strpos($header, ':');
$label = substr($header, 0, $pos);
$value = substr($header, $pos + 2);
switch ($label) {
case 'Cookie':
curl_setopt($ch, CURLOPT_COOKIE, $value);
+ unset($headers[$i]);
break;
case 'User-Agent':
curl_setopt($ch, CURLOPT_USERAGENT, $value);
+ unset($headers[$i]);
break;
case 'Referer':
curl_setopt($ch, CURLOPT_REFERER, $value);
+ unset($headers[$i]);
break;
- default:
- $http_header[] = $header;
}
}
// all remaining headers
- if ($http_header) {
- curl_setopt($ch, CURLOPT_HTTPHEADER, $http_header);
+ if ($headers) {
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}
/**
More information about the Solar-svn
mailing list