Loading crates/tor-dirclient/src/err.rs +5 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,10 @@ pub enum RequestError { /// believes in, we would reject as untimely.) #[error("Too much clock skew with directory cache")] TooMuchClockSkew, /// The requested SHA256 digest of microdescriptors is empty. #[error("The requested SHA256 digest of microdescriptors is empty")] MdSha256Empty, } impl From<TimeoutError> for RequestError { Loading Loading @@ -155,6 +159,7 @@ impl HasKind for RequestError { E::HttpError(_) => EK::Internal, E::ContentEncoding(_) => EK::TorProtocolViolation, E::TooMuchClockSkew => EK::TorDirectoryError, E::MdSha256Empty => EK::Internal, } } } Loading crates/tor-dirclient/src/request.rs +6 −2 Original line number Diff line number Diff line Loading @@ -310,7 +310,9 @@ impl MicrodescRequest { impl Requestable for MicrodescRequest { fn make_request(&self) -> Result<http::Request<()>> { // TODO: require that self.digests is nonempty. if self.digests.is_empty() { return Err(RequestError::MdSha256Empty); } let mut digests = self.digests.clone(); digests.sort_unstable(); Loading Loading @@ -393,7 +395,9 @@ impl Requestable for RouterDescRequest { uri.push_str("all"); } else { uri.push_str("d/"); // TODO: require that self.digests is nonempty. if self.digests.is_empty() { return Err(RequestError::MdSha256Empty); } let mut digests = self.digests.clone(); digests.sort_unstable(); let ids: Vec<String> = digests.iter().map(hex::encode).collect(); Loading Loading
crates/tor-dirclient/src/err.rs +5 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,10 @@ pub enum RequestError { /// believes in, we would reject as untimely.) #[error("Too much clock skew with directory cache")] TooMuchClockSkew, /// The requested SHA256 digest of microdescriptors is empty. #[error("The requested SHA256 digest of microdescriptors is empty")] MdSha256Empty, } impl From<TimeoutError> for RequestError { Loading Loading @@ -155,6 +159,7 @@ impl HasKind for RequestError { E::HttpError(_) => EK::Internal, E::ContentEncoding(_) => EK::TorProtocolViolation, E::TooMuchClockSkew => EK::TorDirectoryError, E::MdSha256Empty => EK::Internal, } } } Loading
crates/tor-dirclient/src/request.rs +6 −2 Original line number Diff line number Diff line Loading @@ -310,7 +310,9 @@ impl MicrodescRequest { impl Requestable for MicrodescRequest { fn make_request(&self) -> Result<http::Request<()>> { // TODO: require that self.digests is nonempty. if self.digests.is_empty() { return Err(RequestError::MdSha256Empty); } let mut digests = self.digests.clone(); digests.sort_unstable(); Loading Loading @@ -393,7 +395,9 @@ impl Requestable for RouterDescRequest { uri.push_str("all"); } else { uri.push_str("d/"); // TODO: require that self.digests is nonempty. if self.digests.is_empty() { return Err(RequestError::MdSha256Empty); } let mut digests = self.digests.clone(); digests.sort_unstable(); let ids: Vec<String> = digests.iter().map(hex::encode).collect(); Loading