Benign cargo Download

test_ws.rs

Rust test marker or harnessimports openssl::ssl::SslAcceptor
SHA-256d7a01810a378fadd1a6217b95df3bae13e4c1b0ba7c90d341be194c4ed7ad082

Evidence

imports actix::prelude::* lines 4–27
4:22…
5extern crate http;
6extern crate rand;
7
8use bytes::Bytes;
9use futures::Stream;
10use rand::distributions::Alphanumeric;
11use rand::Rng;
12
13#[cfg(feature = "alpn")]
14extern crate openssl;
15#[cfg(feature = "rust-tls")]
16extern crate rustls;
17
18use actix::prelude::*;
19use actix_web::*;
20
21struct Ws;
22
23impl Actor for Ws {
24 type Context = ws::WebsocketContext<Self>;
25}
26
27impl StreamHandler<ws::Message, ws:: …
#[test] attribute lines 33–42
⋯4 lines
37}
38
39#[test]
40fn test_simple() {
41 let mut srv = test::TestServer::new(|app| app.handler(|req| ws::start(req, Ws)));
42 let (reader, mu …
English function-word token "the" lines 78–81
78:40… ).f(start_ws_resource));
79 });
80 // fetch the sockets for the resource at a given path.
81 let (reader, mut writer) = srv.ws_at(PATH).unwra …
imports openssl::ssl::SslAcceptor lines 282–289
282:14… rver_ssl() {
283 extern crate openssl;
284 use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod};
285
286 // load ssl keys
287 let mut builder = SslAcceptor::mozilla_intermediate(SslMethod::tls()).unwrap();
288 builder
289 .set_pri …
imports rustls::internal::pemfile::certs lines 318–329
318:31…
319 extern crate rustls;
320 use rustls::internal::pemfile::{certs, rsa_private_keys};
321 use rustls::{NoClientAuth, ServerConfig};
322 use std::fs::File;
323 use std::io::BufReader;
324
325 // load ssl keys
326 let mut config = ServerConfig::new(NoClientAuth::new());
327 let cert_file = &mut BufReader::new(File::open("tests/cert.pem").unwrap());
328 let key_file = &mut BufReader::new(File::open("tests/key.pem").unwrap());
329 let cert_chain …

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.