Opened 12 years ago
Closed 12 years ago
#17731 closed defect (bug) (worksforme)
Curl HTTP request via proxy contain error
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0.4 |
Component: | HTTP API | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
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.
Change History (4)
#2
@
12 years ago
- Keywords reporter-feedback added
3.2 appears to work correctly for me.
We no longer use CURLINFO_HEADER_SIZE at all, so any potential string functions which were previously failing are no longer a problem.
hpatoio: You may wish to try using a copy of Trunk's class-http.php as it should be compatible with 3.1, see if that solves the problem for you if you're not up for using a 3.2 beta.
just to confirm, You're using 3.0.4? Have you tried 3.1 or 3.2 beta releases in that environment?
3.2 has changed some code in relation to curl header parsing, so If you can test a beta of 3.2, that'd be greatly appreciated.