WIP: work on http load test (now partly working) and http protocol

This commit is contained in:
Joakim Frostegård 2020-07-20 14:30:36 +02:00
parent 5b0d364ccf
commit d1e9d24773
10 changed files with 326 additions and 226 deletions

View file

@ -6,6 +6,22 @@ use smartstring::{SmartString, LazyCompact};
use super::response::ResponsePeer;
pub fn urlencode_20_bytes(input: [u8; 20]) -> Vec<u8> {
let mut tmp = [0u8; 40];
hex::encode_to_slice(&input, &mut tmp);
let mut output = Vec::with_capacity(60);
for chunk in tmp.chunks_exact(2){
output.push(b'%');
output.extend_from_slice(chunk);
}
output
}
/// Not for serde
pub fn deserialize_20_bytes(value: SmartString<LazyCompact>) -> anyhow::Result<[u8; 20]> {
let mut arr = [0u8; 20];