aquatic_http: store info_hash and peer_id in [u8; 20]

This commit is contained in:
Joakim Frostegård 2020-07-03 13:17:02 +02:00
parent f28abbb7f6
commit 52a29fc14a
2 changed files with 37 additions and 19 deletions

View file

@ -13,9 +13,9 @@ use serde_helpers::*;
#[serde(transparent)]
pub struct PeerId(
#[serde(
deserialize_with = "deserialize_20_char_string",
deserialize_with = "deserialize_20_bytes",
)]
pub String
pub [u8; 20]
);
@ -23,9 +23,9 @@ pub struct PeerId(
#[serde(transparent)]
pub struct InfoHash(
#[serde(
deserialize_with = "deserialize_20_char_string",
deserialize_with = "deserialize_20_bytes",
)]
pub String
pub [u8; 20]
);
@ -180,8 +180,6 @@ impl Request {
let mut processed = String::new();
for (i, part) in query_string.split('%').enumerate(){
println!("{}", part);
if i == 0 {
processed.push_str(part);
} else if part.len() >= 2 {