dmitry Thu Jan 20 01:08:04 2005 EDT
Modified files:
/php-src/ext/soap php_http.c soap.c
Log:
Support for HTTPS with digital certificates.
http://cvs.php.net/diff.php/php-src/ext/soap/php_http.c?r1=1.60&r2=1.61&ty=u
Index: php-src/ext/soap/php_http.c
diff -u php-src/ext/soap/php_http.c:1.60 php-src/ext/soap/php_http.c:1.61
--- php-src/ext/soap/php_http.c:1.60 Wed Dec 1 13:22:40 2004
+++ php-src/ext/soap/php_http.c Thu Jan 20 01:08:04 2005
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.c,v 1.60 2004/12/01 18:22:40 dmitry Exp $ */
+/* $Id: php_http.c,v 1.61 2005/01/20 06:08:04 dmitry Exp $ */
#include "php_soap.h"
#include "ext/standard/base64.h"
@@ -84,6 +84,7 @@
zval **proxy_host, **proxy_port;
char *host;
#ifdef ZEND_ENGINE_2
+ php_stream_context *context = NULL;
char *name;
long namelen;
#endif
@@ -107,12 +108,26 @@
#ifdef ZEND_ENGINE_2
namelen = spprintf(&name, 0, "%s://%s:%d", (use_ssl && !*use_proxy)?
"ssl" : "tcp", host, port);
+ if (use_ssl) {
+ zval **tmp;
+
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_local_cert",
sizeof("_local_cert"), (void **) &tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_STRING) {
+ context = php_stream_context_alloc();
+ php_stream_context_set_option(context, "ssl",
"local_cert", *tmp);
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr),
"_passphrase", sizeof("_passphrase"), (void **) &tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_STRING) {
+ php_stream_context_set_option(context, "ssl",
"passphrase", *tmp);
+ }
+ }
+ }
stream = php_stream_xport_create(name, namelen,
ENFORCE_SAFE_MODE | REPORT_ERRORS,
STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
NULL /*persistent_id*/,
NULL /*timeout*/,
- NULL, NULL, NULL);
+ context,
+ NULL, NULL);
efree(name);
#else
stream = php_stream_sock_open_host(host, port, SOCK_STREAM, NULL, NULL);
http://cvs.php.net/diff.php/php-src/ext/soap/soap.c?r1=1.127&r2=1.128&ty=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.127 php-src/ext/soap/soap.c:1.128
--- php-src/ext/soap/soap.c:1.127 Tue Dec 14 08:58:57 2004
+++ php-src/ext/soap/soap.c Thu Jan 20 01:08:04 2005
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.127 2004/12/14 13:58:57 dmitry Exp $ */
+/* $Id: soap.c,v 1.128 2005/01/20 06:08:04 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1967,6 +1967,14 @@
}
}
}
+ if (zend_hash_find(ht, "local_cert", sizeof("local_cert"),
(void**)&tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_STRING) {
+ add_property_stringl(this_ptr, "_local_cert",
Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
+ if (zend_hash_find(ht, "passphrase",
sizeof("passphrase"), (void**)&tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_STRING) {
+ add_property_stringl(this_ptr, "_passphrase",
Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
+ }
+ }
if (zend_hash_find(ht, "trace", sizeof("trace"), (void**)&tmp)
== SUCCESS &&
(Z_TYPE_PP(tmp) == IS_BOOL || Z_TYPE_PP(tmp) == IS_LONG) &&
Z_LVAL_PP(tmp) == 1) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php