php_openssl_sockop_set_option,
};
- static char * get_sni(php_stream_context *ctx, char *resourcename, long resourcenamelen, int is_persistent TSRMLS_DC) {
+ static int get_crypto_method(php_stream_context *ctx) {
+ if (ctx) {
+ zval **val = NULL;
+ long crypto_method;
+
+ if (php_stream_context_get_option(ctx, "ssl", "crypto_method", &val) == SUCCESS) {
+ convert_to_long_ex(val);
+ crypto_method = (long)Z_LVAL_PP(val);
+
+ switch (crypto_method) {
+ case STREAM_CRYPTO_METHOD_SSLv2_CLIENT:
+ case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
+ case STREAM_CRYPTO_METHOD_SSLv23_CLIENT:
+ case STREAM_CRYPTO_METHOD_TLS_CLIENT:
+ case STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT:
+ case STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT:
+ return crypto_method;
+ }
+
+ }
+ }
+
+ return STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
+ }
-
+ static char * get_sni(php_stream_context *ctx, const char *resourcename, size_t resourcenamelen, int is_persistent TSRMLS_DC) {
php_url *url;
if (ctx) {