Skip to content

Commit

Permalink
Expose to HHVM isSSL and sslSessionReused
Browse files Browse the repository at this point in the history
Summary: New functions about SSL connections added to Connection. Now exposing them to HHVM.

Reviewed By: anca-agape

Differential Revision: D2777300

fb-gh-sync-id: 968482f5fdf16e116b26a174325f159c3f948df3
  • Loading branch information
drilibo authored and hhvm-bot committed Jan 6, 2016
1 parent e030612 commit 5331a1e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hphp/hack/hhi/stdlib/builtins_async_mysql.hhi
Expand Up @@ -101,6 +101,8 @@ class AsyncMysqlConnection {
public function close(): void{ }
public function releaseConnection() { }
public function serverInfo() { }
public function sslSessionReused() { }
public function isSSL() { }

This comment has been minimized.

Copy link
@fredemmott

fredemmott Jan 6, 2016

Contributor

no return types?

This comment has been minimized.

Copy link
@drilibo

drilibo via email Jan 8, 2016

Author Contributor
public function warningCount() { }
public function host(): string { }
public function port(): int { }
Expand Down
20 changes: 20 additions & 0 deletions hphp/runtime/ext/async_mysql/ext_async_mysql.cpp
Expand Up @@ -612,6 +612,26 @@ String HHVM_METHOD(AsyncMysqlConnection, serverInfo) {
return ret;
}

bool HHVM_METHOD(AsyncMysqlConnection, sslSessionReused) {

This comment has been minimized.

Copy link
@fredemmott

fredemmott Jan 6, 2016

Contributor

@drilibo : seems a bit weird that this isn't 'isSslSessionReused' given the prefix on isSSL - is this an oversight or is there some background here?

This comment has been minimized.

Copy link
@fredemmott

fredemmott Jan 6, 2016

Contributor
  • isSSLSessionReused
auto* data = Native::data<AsyncMysqlConnection>(this_);

bool ret = false;
if (data->m_conn && !data->m_closed) {
ret = data->m_conn->sslSessionReused();
}
return ret;
}

bool HHVM_METHOD(AsyncMysqlConnection, isSSL) {
auto* data = Native::data<AsyncMysqlConnection>(this_);

bool ret = false;
if (data->m_conn && !data->m_closed) {
ret = data->m_conn->isSSL();
}
return ret;
}

int HHVM_METHOD(AsyncMysqlConnection, warningCount) {
auto* data = Native::data<AsyncMysqlConnection>(this_);

Expand Down
23 changes: 23 additions & 0 deletions hphp/runtime/ext/async_mysql/ext_async_mysql.php
Expand Up @@ -380,6 +380,29 @@ function releaseConnection(): mixed;
<<__HipHopSpecific, __Native>>
function serverInfo(): string;

/**
* Returns whether or not the current connection reused the SSL session
* from another SSL connection. The session is set by MySSLContextProvider.
* Some cases, the server can deny the session that was set and the handshake
* will create a new one, in those cases this function will return `false`.
* If this connections isn't SSL, `false` will be returned as well.
*
* @return - `true` if this is a SSL connection and the SSL session was
* reused; `false` otherwise.
*/
<<__HipHopSpecific, __Native>>
function sslSessionReused(): bool;


/**
* Returns whether or not the current connection was established as SSL based
* on client flag exchanged during handshake.
*
* @return - `true` if this is a SSL connection; `false` otherwise
*/
<<__HipHopSpecific, __Native>>
function isSSL(): bool;

/**
* The number of errors, warnings, and notes returned during execution of
* the previous SQL statement.
Expand Down

0 comments on commit 5331a1e

Please sign in to comment.