From deab634247356b79e10ce6ef537377214fb0cd75 Mon Sep 17 00:00:00 2001
From: Yuki Okushi <huyuumi.dev@gmail.com>
Date: Fri, 3 Jul 2020 09:08:24 +0900
Subject: [PATCH] actix-http: Update `sha-1` to 0.9 (#1586)

---
 .github/workflows/linux.yml | 2 +-
 CHANGES.md                  | 1 +
 README.md                   | 2 +-
 actix-http/CHANGES.md       | 2 ++
 actix-http/Cargo.toml       | 2 +-
 actix-http/src/ws/proto.rs  | 6 +++---
 rust-toolchain              | 2 +-
 test-server/Cargo.toml      | 2 --
 8 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index ae804cc5..a2dfc5da 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -8,7 +8,7 @@ jobs:
       fail-fast: false
       matrix:
         version:
-          - 1.40.0 # MSRV
+          - 1.41.1 # MSRV
           - stable
           - nightly
 
diff --git a/CHANGES.md b/CHANGES.md
index f4c04cd0..8f15eea1 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -13,6 +13,7 @@
 
 * Fix actix_http::h1::dispatcher so it returns when HW_BUFFER_SIZE is reached. Should reduce peak memory consumption during large uploads. [#1550]
 * Migrate cookie handling to `cookie` crate. Actix-web no longer requires `ring` dependency.
+* MSRV is now 1.41.1
 
 ### Fixed
 
diff --git a/README.md b/README.md
index ade63287..a9b5e011 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
 [![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 [![Documentation](https://docs.rs/actix-web/badge.svg)](https://docs.rs/actix-web)
 [![Download](https://img.shields.io/crates/d/actix-web.svg)](https://crates.io/crates/actix-web)
-[![Version](https://img.shields.io/badge/rustc-1.40+-lightgray.svg)](https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html)
+[![Version](https://img.shields.io/badge/rustc-1.41+-lightgray.svg)](https://blog.rust-lang.org/2020/02/27/Rust-1.41.1.html)
 ![License](https://img.shields.io/crates/l/actix-web.svg)
 
   </p>
diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md
index 49599b9b..d18af162 100644
--- a/actix-http/CHANGES.md
+++ b/actix-http/CHANGES.md
@@ -5,6 +5,8 @@
 ### Changed
 
 * Migrate cookie handling to `cookie` crate.
+* Update `sha-1` to 0.9
+* MSRV is now 1.41.1
 
 ## [2.0.0-alpha.4] - 2020-05-21
 
diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml
index 8b9b8c82..6095f89e 100644
--- a/actix-http/Cargo.toml
+++ b/actix-http/Cargo.toml
@@ -76,7 +76,7 @@ rand = "0.7"
 regex = "1.3"
 serde = "1.0"
 serde_json = "1.0"
-sha-1 = "0.8"
+sha-1 = "0.9"
 slab = "0.4"
 serde_urlencoded = "0.6.1"
 time = { version = "0.2.7", default-features = false, features = ["std"] }
diff --git a/actix-http/src/ws/proto.rs b/actix-http/src/ws/proto.rs
index dd3078a6..fc271a8f 100644
--- a/actix-http/src/ws/proto.rs
+++ b/actix-http/src/ws/proto.rs
@@ -208,10 +208,10 @@ pub fn hash_key(key: &[u8]) -> String {
     use sha1::Digest;
     let mut hasher = sha1::Sha1::new();
 
-    hasher.input(key);
-    hasher.input(WS_GUID.as_bytes());
+    hasher.update(key);
+    hasher.update(WS_GUID.as_bytes());
 
-    base64::encode(hasher.result().as_ref())
+    base64::encode(&hasher.finalize())
 }
 
 #[cfg(test)]
diff --git a/rust-toolchain b/rust-toolchain
index 32b7211c..f86fb9cb 100644
--- a/rust-toolchain
+++ b/rust-toolchain
@@ -1 +1 @@
-1.40.0
+1.41.1
diff --git a/test-server/Cargo.toml b/test-server/Cargo.toml
index 6265cd41..2c526e67 100644
--- a/test-server/Cargo.toml
+++ b/test-server/Cargo.toml
@@ -43,11 +43,9 @@ bytes = "0.5.3"
 futures-core = { version = "0.3.5", default-features = false }
 http = "0.2.0"
 log = "0.4"
-env_logger = "0.7"
 socket2 = "0.3"
 serde = "1.0"
 serde_json = "1.0"
-sha1 = "0.6"
 slab = "0.4"
 serde_urlencoded = "0.6.1"
 time = { version = "0.2.7", default-features = false, features = ["std"] }