[wp-trac] [WordPress Trac] #17731: Curl HTTP request via proxy contain error
WordPress Trac
wp-trac at lists.automattic.com
Thu Jun 9 09:38:14 UTC 2011
#17731: Curl HTTP request via proxy contain error
--------------------------+-----------------------------
Reporter: hpatoio | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: HTTP | Version: 3.0.4
Severity: normal | Keywords:
--------------------------+-----------------------------
Hello, I've just faced a problem while I was doing curl request via
proxy(squid)
Basically the response with proxy is
{{{
HTTP/1.0 200 Connection established
HTTP/1.1 200 OK
Date: Sun, 22 Feb 2009 09:30:52 GMT
Server: Apache/2.2.8
X-Powered-By: PHP/5.3.1
[...]
}}}
without is
{{{
HTTP/1.1 200 OK
Date: Sun, 22 Feb 2009 09:30:52 GMT
Server: Apache/2.2.8
X-Powered-By: PHP/5.3.1
[...]
}}}
This cause a problem during the response parsing because the value
returned by curl_getinfo($handle, CURLINFO_HEADER_SIZE) doesn't take in
account "HTTP/1.0 200 Connection established"
The following lines of code solve the problem
{{{
if ( ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) &&
(stripos($theResponse, "HTTP/1.0 200 Connection established\r\n\r\n") !==
false) ) {
$theResponse = str_ireplace("HTTP/1.0 200 Connection
established\r\n\r\n", '', $theResponse);
}
}
}}}
Am I the only one with this problem ? I've searched and it doesn't look
like a curl bug.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17731>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list