Index: third_party/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi |
diff --git a/third_party/WebKit/LayoutTests/http/tests/websocket/echo_wsh.py b/third_party/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi |
similarity index 72% |
copy from third_party/WebKit/LayoutTests/http/tests/websocket/echo_wsh.py |
copy to third_party/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi |
index 9851d26b37b4c9a72ceac14d5866df3c61e9ee60..23cee7bd6e2c4512b8a80cc35b3432fd3170bb90 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/websocket/echo_wsh.py |
+++ b/third_party/grpc/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi |
@@ -1,4 +1,4 @@ |
-# Copyright 2009, 2011, Google Inc. |
+# Copyright 2016, Google Inc. |
# All rights reserved. |
# |
# Redistribution and use in source and binary forms, with or without |
@@ -27,22 +27,18 @@ |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+from libc.string cimport memcpy |
-_GOODBYE_MESSAGE = u'Goodbye' |
+import pkg_resources |
-def web_socket_do_extra_handshake(request): |
- pass # Always accept. |
- |
- |
-def web_socket_transfer_data(request): |
- while True: |
- line = request.ws_stream.receive_message() |
- if line is None: |
- return |
- if isinstance(line, unicode): |
- request.ws_stream.send_message(line, binary=False) |
- if line == _GOODBYE_MESSAGE: |
- return |
- else: |
- request.ws_stream.send_message(line, binary=True) |
+cdef grpc_ssl_roots_override_result ssl_roots_override_callback( |
+ char **pem_root_certs) with gil: |
+ temporary_pem_root_certs = pkg_resources.resource_string( |
+ 'grpc._cython', '_credentials/roots.pem') |
+ pem_root_certs[0] = <char *>gpr_malloc(len(temporary_pem_root_certs) + 1) |
+ memcpy( |
+ pem_root_certs[0], <char *>temporary_pem_root_certs, |
+ len(temporary_pem_root_certs)) |
+ pem_root_certs[0][len(temporary_pem_root_certs)] = '\0' |
+ return GRPC_SSL_ROOTS_OVERRIDE_OK |