Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Unified Diff: third_party/grpc/test/core/bad_ssl/servers/cert.c

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/grpc/test/core/bad_ssl/servers/alpn.c ('k') | third_party/grpc/test/core/census/context_test.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/grpc/test/core/bad_ssl/servers/cert.c
diff --git a/third_party/WebKit/Source/modules/websockets/WebSocket.idl b/third_party/grpc/test/core/bad_ssl/servers/cert.c
similarity index 52%
copy from third_party/WebKit/Source/modules/websockets/WebSocket.idl
copy to third_party/grpc/test/core/bad_ssl/servers/cert.c
index 83dd66c99829673cbd3b82f611f63a4c40942c7c..4edef50b67a90bbc67d23a43c78f55081c4eb168 100644
--- a/third_party/WebKit/Source/modules/websockets/WebSocket.idl
+++ b/third_party/grpc/test/core/bad_ssl/servers/cert.c
@@ -1,6 +1,7 @@
/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2010, 2011 Apple Inc. All Rights Reserved.
+ *
+ * Copyright 2015-2016, Google Inc.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -27,44 +28,52 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
*/
-// https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface
+#include <string.h>
+
+#include <grpc/grpc.h>
+#include <grpc/grpc_security.h>
+#include <grpc/support/log.h>
+#include <grpc/support/useful.h>
+
+#include "src/core/support/load_file.h"
+
+#include "test/core/bad_ssl/server_common.h"
+#include "test/core/end2end/data/ssl_test_data.h"
+
+/* This server will present an untrusted cert to the connecting client,
+ * causing the SSL handshake to fail */
+
+int main(int argc, char **argv) {
+ const char *addr = bad_ssl_addr(argc, argv);
+ grpc_ssl_pem_key_cert_pair pem_key_cert_pair;
+ grpc_server_credentials *ssl_creds;
+ grpc_server *server;
+ gpr_slice cert_slice, key_slice;
+ int ok;
+
+ grpc_init();
-enum BinaryType { "blob", "arraybuffer" };
+ cert_slice = gpr_load_file("src/core/tsi/test_creds/badserver.pem", 1, &ok);
+ GPR_ASSERT(ok);
+ key_slice = gpr_load_file("src/core/tsi/test_creds/badserver.key", 1, &ok);
+ GPR_ASSERT(ok);
+ pem_key_cert_pair.private_key = (const char *)GPR_SLICE_START_PTR(key_slice);
+ pem_key_cert_pair.cert_chain = (const char *)GPR_SLICE_START_PTR(cert_slice);
-[
- ActiveScriptWrappable,
- Constructor(DOMString url, optional (DOMString or sequence<DOMString>) protocols),
- ConstructorCallWith=ExecutionContext,
- DependentLifetime,
- Exposed=(Window,Worker),
- ImplementedAs=DOMWebSocket,
- RaisesException=Constructor,
-] interface WebSocket : EventTarget {
- readonly attribute DOMString url;
+ ssl_creds =
+ grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0, NULL);
+ server = grpc_server_create(NULL, NULL);
+ GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds));
+ grpc_server_credentials_release(ssl_creds);
- // ready state
- const unsigned short CONNECTING = 0;
- const unsigned short OPEN = 1;
- const unsigned short CLOSING = 2;
- const unsigned short CLOSED = 3;
- readonly attribute unsigned short readyState;
- readonly attribute unsigned long bufferedAmount;
+ gpr_slice_unref(cert_slice);
+ gpr_slice_unref(key_slice);
- // networking
- attribute EventHandler onopen;
- attribute EventHandler onerror;
- attribute EventHandler onclose;
- readonly attribute DOMString extensions;
- readonly attribute DOMString protocol;
- [RaisesException] void close([Clamp] optional unsigned short code, optional USVString reason);
+ bad_ssl_run(server);
+ grpc_shutdown();
- // messaging
- attribute EventHandler onmessage;
- attribute BinaryType binaryType;
- [RaisesException] void send(USVString data);
- [RaisesException] void send(Blob data);
- [RaisesException] void send(ArrayBuffer data);
- [RaisesException] void send(ArrayBufferView data);
-};
+ return 0;
+}
« no previous file with comments | « third_party/grpc/test/core/bad_ssl/servers/alpn.c ('k') | third_party/grpc/test/core/census/context_test.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698