mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-22 09:31:07 +00:00
Don't fail deliver for 400 Bad Request
This commit is contained in:
parent
ea699a7978
commit
fac40c1853
1 changed files with 14 additions and 8 deletions
|
@ -1,6 +1,9 @@
|
||||||
use crate::error::{Error, ErrorKind};
|
use crate::error::{Error, ErrorKind};
|
||||||
use activitystreams::iri_string::types::IriString;
|
use activitystreams::iri_string::types::IriString;
|
||||||
use actix_web::{http::header::Date, web::Bytes};
|
use actix_web::{
|
||||||
|
http::{header::Date, StatusCode},
|
||||||
|
web::Bytes,
|
||||||
|
};
|
||||||
use awc::Client;
|
use awc::Client;
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
use http_signature_normalization_actix::prelude::*;
|
use http_signature_normalization_actix::prelude::*;
|
||||||
|
@ -392,10 +395,12 @@ impl Requests {
|
||||||
self.reset_err();
|
self.reset_err();
|
||||||
|
|
||||||
if !res.status().is_success() {
|
if !res.status().is_success() {
|
||||||
|
// Bad Request means the server didn't understand our activity - that's fine
|
||||||
|
if res.status() != StatusCode::BAD_REQUEST {
|
||||||
if let Ok(bytes) = res.body().await {
|
if let Ok(bytes) = res.body().await {
|
||||||
if let Ok(s) = String::from_utf8(bytes.as_ref().to_vec()) {
|
if let Ok(s) = String::from_utf8(bytes.as_ref().to_vec()) {
|
||||||
if !s.is_empty() {
|
if !s.is_empty() {
|
||||||
debug!("Response from {}, {}", inbox.as_str(), s);
|
warn!("Response from {}, {}", inbox.as_str(), s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -403,6 +408,7 @@ impl Requests {
|
||||||
self.breakers.fail(&inbox);
|
self.breakers.fail(&inbox);
|
||||||
return Err(ErrorKind::Status(inbox.to_string(), res.status()).into());
|
return Err(ErrorKind::Status(inbox.to_string(), res.status()).into());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.breakers.succeed(&inbox);
|
self.breakers.succeed(&inbox);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue