patch for propagating curl errors in PEAR::SOAP HTTPS/SSL/certificates
| From: | (Jonathan Schilling) | Date: | Fri, 04 Apr 2003 23:44:00 +0000 |
| Subject: | patch for propagating curl errors in PEAR::SOAP HTTPS/SSL/certificates | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-531@lists.php.net to get a copy of this message | ||
More on PEAR::SOAP using HTTPS/SSL and certificates.
The current SOAP/Transport/HTTP.php sendHTTPS method
doesn't propagate any error messages that might come out of
the underlying curl_exec call it does.
Thus, you lose information about why the call failed
(which happens a lot when you are trying to get certificates
set up correctly) and are just left with an unhelpful
generic 'couldn't build response' error (even when
CURLOPT_VERBOSE is set on).
By making this small change:
*** HTTP.php..before 2003-03-18 03:44:41.000000000 -0800
--- HTTP.php 2003-04-04 10:28:52.000000000 -0800
***************
*** 367,372 ****
--- 367,377 ----
}
}
$this->response = curl_exec($ch);
+ if (! $this->response) {
+ $m = 'curl_exec error ' . curl_errno($ch) . ' ' . curl_error($ch);
+ curl_close($ch);
+ return $this->_raiseSoapFault($m);
+ }
curl_close($ch);
return $this->response;
you can now get back more useful fault messages. A couple of examples
I can produce by not setting or incorrectly setting the various curl
certificate options are:
Error! curl_exec error 35 SSL: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake
failure
Error! curl_exec error 35 error setting cerficate verify locations
They don't tell you the exact problem, but at least you have some
idea of where to start looking.
Jonathan Schilling The SCO Group jls@sco.com