diff options
author | Daniel Lowrey <rdlowrey@php.net> | 2015-03-04 13:56:58 -0700 |
---|---|---|
committer | Daniel Lowrey <rdlowrey@php.net> | 2015-03-04 13:56:58 -0700 |
commit | b5d97140c09f5aca752c8cb4bbd5a091fe5e330f (patch) | |
tree | 231ee2070af86074021554c23dfc291f71b0ba59 /ext/standard/streamsfuncs.c | |
parent | c9bd24de7adb20dad4b94e9295f6df6cdb0ce594 (diff) | |
parent | 8680fc83316be812748d3bedfc785603f263a568 (diff) | |
download | php-git-b5d97140c09f5aca752c8cb4bbd5a091fe5e330f.tar.gz |
Merge branch 'tls-alpn'
* tls-alpn:
Improve test to target specific issue
Misc updates/cleanup
Add TLS ALPN extension support in crypto client/server streams
Add stream_socket_crypto_info() function
Update for compatibility with newer openssl libs
Diffstat (limited to 'ext/standard/streamsfuncs.c')
-rw-r--r-- | ext/standard/streamsfuncs.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index a86aae25f0..11dca39bc1 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -1485,6 +1485,46 @@ PHP_FUNCTION(stream_socket_enable_crypto) } /* }}} */ +/* {{{ proto int stream_socket_crypto_info(resource stream [, int infotype]) + Retrieve information about the stream's crypto session */ +PHP_FUNCTION(stream_socket_crypto_info) +{ + zval *zstream = NULL; + php_stream *stream = NULL; + zend_long infotype = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &zstream, &infotype) == FAILURE) { + RETURN_FALSE; + } + + php_stream_from_zval(stream, zstream); + + if (infotype == 0) { + infotype = STREAM_CRYPTO_INFO_ALL; + } else { + switch (infotype) { + case STREAM_CRYPTO_INFO_CIPHER_NAME: + case STREAM_CRYPTO_INFO_CIPHER_BITS: + case STREAM_CRYPTO_INFO_CIPHER_VERSION: + case STREAM_CRYPTO_INFO_CIPHER: + case STREAM_CRYPTO_INFO_PROTOCOL: + case STREAM_CRYPTO_INFO_ALPN_PROTOCOL: + case STREAM_CRYPTO_INFO_ALL: + break; + default: + php_error_docref(NULL, E_WARNING, "unknown crypto info type"); + RETURN_FALSE; + } + } + + if (php_stream_xport_crypto_info(stream, infotype, return_value) != PHP_STREAM_OPTION_RETURN_OK) { + RETURN_FALSE; + } + + /* return_value populated by php_stream_xport_crypto_info() upon success */ +} +/* }}} */ + /* {{{ proto string stream_resolve_include_path(string filename) Determine what file will be opened by calls to fopen() with a relative path */ PHP_FUNCTION(stream_resolve_include_path) |