Replace some unsafe code with a safe stdlib wrapper.
Replace some unsafe code with a safe stdlib wrapper.

chris-morgan/rust-http,chris-morgan/rust-http,chris-morgan/rust-http,Shraddha512/rust-http,servo/rust-http,servo/rust-http,servo/rust-http,chris-morgan/rust-http,Shraddha512/rust-http,Shraddha512/rust-http,Shraddha512/rust-http,servo/rust-http,Shraddha512/rust-http